Link to home
Start Free TrialLog in
Avatar of bhomass
bhomass

asked on

JMeter regex help

I want to extract a value from an json response string.

it looks like
{success:true, regcode:'49834', message:'kskkdsdf' }

JMeter let's you use regex to grab the value and tie it to a variable.

can someone help me create this regex expression.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Which value? In Java or JavaScript?
Avatar of bhomass
bhomass

ASKER

I want to get the regcode value. this is inside jmeter, I don't see how the question of java or javascript is relevant. maybe there is something I don't understand about jmeter. I was thinking of using the regular expression extractor. I would love to hear there are other ways.
>>I don't see how the question of java or javascript is relevant

It's relevant since the regex syntax is quite different in each case
Avatar of bhomass

ASKER

I see.
the example given in jmeter is
<a href="([^"]+)"
which extracts all the hyperlinks in the returned html page.

can you tell which camp this is in?
Having said that, regex itself shouldn't be relevant since a json api should be used really
Avatar of bhomass

ASKER

I am lost. the jmeter example gave no indication of a json api. it is a graphic based app, and it is using the regex expression I provided to extract the hyperlinks.

my question is, based on this, is it possible to figure what expression to use to extract the regcode value from a returned json string.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
:-)