Solved

JMeter regex help

Posted on 2009-04-05
8
464 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
Comment Utility
Which value? In Java or JavaScript?
0
 

Author Comment

by:bhomass
Comment Utility
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
Comment Utility
>>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
 

Author Comment

by:bhomass
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 86

Expert Comment

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

Author Comment

by:bhomass
Comment Utility
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
Comment Utility
Try the following
regcode:'([^']+)

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now