The_BMan
The_BMan

Reputation: 125

Jmeter Regex extractor, specific

I have a response within Jmeter in the form of

r.handleCallback("46","0",["","0","1","2","3"]);

What REGEX can I use to extract just the 0 , 1, 2, or 3 from this string?

I tried this

.?\"0\".?(\"3\")

but this mathces = r.handleCallback("46","0",["","0","1","2","3

and I do not want the preceding string of text nor do I want my target element {0,1,2,3} to be encoding into the REGEX.

Thanks in advance

Upvotes: 0

Views: 214

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

Configure your Regular Expression Extractor as follows:

  • Reference Name: anything meaningful, i.e. foo
  • Regular Expression: (\d+)(?=(?:(?!\[).)*\])
  • Template: $1$
  • Match No: -1

You will get the following JMeter Variables generated:

foo_1=0
foo_2=1
foo_3=2
foo_4=3

Demo:

JMeter Regex Demo

References:

Upvotes: 2

Related Questions