Highlighted
qmon
Visitor.
1099 views

How to regex through a json Response

Jump to solution

Hej Community,

never had such a trouble extracting a dynamic value in LR. I'm disparing. 
I have a CRM System and want to extract a specific search result. The response is a json. But I need to regexp because there is a full html page in the "content"-part of the json response.

RAW Data:
Content-Type: application/json

{ ...
content: ... h1 class=\\"user-name\\">\\n <a href=\\"http:\\\/\\\/192.168.0.137\\\/task\\\/view\\\/29\\"
... }

Response Body:

{ ...
content: ... h1 class=\"user-name\">\n <a href=\"http:\/\/192.168.0.137\/task\/view\/29\"
...}

My Regex for the number in the URL looks like:

web_reg_save_param_regexp(
"ParamName=Number",
"RegExp=h1 class=\\"user-name(.*?)href(.*?)view\\\/(.*?)\\", => for Response Body 
"RegExp=h1 class=\\\\"user-name(.*?)href(.*?)view\\\\\\\/(.*?)\\\\", => for All (RAW)
"Group=3",
"Ordinal=3",
SEARCH_FILTERS,
LAST);


But it won't find a match. I checked it 100 times with: https://regex101.com/

Any help appreciated.

Thanks in advance and greetings from Berlin,
Stephan

0 Likes
1 Solution

Accepted Solutions
qmon
Visitor.

Re: How to regex through a json Response

Jump to solution

There is no need to escape the "/" in LoadRunner. Checking with https://regex101.com/ doesn't work 100%. 

 

0 Likes
1 Reply
qmon
Visitor.

Re: How to regex through a json Response

Jump to solution

There is no need to escape the "/" in LoadRunner. Checking with https://regex101.com/ doesn't work 100%. 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.