Solved

JMeter regex help

Posted on 2009-04-05
8
466 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:bhomass
  • 5
  • 3
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24085281
Which value? In Java or JavaScript?
0
 

Author Comment

by:bhomass
ID: 24089070
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24090014
>>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
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:bhomass
ID: 24090038
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?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24090062
Having said that, regex itself shouldn't be relevant since a json api should be used really
0
 

Author Comment

by:bhomass
ID: 24090197
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.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 75 total points
ID: 24090353
Try the following
regcode:'([^']+)

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24149925
:-)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example issues from command prompt 10 41
Desingning Refactoring existing code 2 24
pagenation logic how it is working in my code 1 29
mysql jsp example issue 32 33
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question