VijayKidecha Trusted Contributor.
Trusted Contributor.
579 views

How to use lr_save_param_regexp() properly

Jump to solution

char *var="(\"title\":\"vaue1\":\"value2\":\"oneview\"},{(\"title\":\"vaue3\":\"value4\":\"oneview\"},(\"title\":\"vaue5\":\"value6\":\"oneview\"},";

 

the above is my variable and I need two thing:

1. everything between title and one view

2. all the values like value1,value2 so on

 

 

What i have tried is,

 lr_save_param_regexp (var,
               strlen(var),
               "RegExp=title(.+)oneview",
               "Ordinal=All",
               "ResultParam=reMatchesParam",
               LAST );

what output i am gettting,

reMatchesParam=\":\"vaue1\":\"value2\":\"oneview\"},{(\"title\":\"vaue3\":\"value4\":\

 

instead of reMatchesParam_1=\":\"vaue1\":\"value2\":\" ,reMatchesParam_2=\":\"vaue3\":\"value4\":\

Please suggest how to use regexp properly or any better method to retrieve the values.

 

Note: I can not use web_reg_param_regexp() as resposne data is encrypted

 

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: How to use lr_save_param_regexp() properly

Jump to solution

By default regular expressions are eager, each operator like '+' and '*' likes to eat as many characters as possible. You can make an operator more 'polite' by adding an '?' behind it.

So when you change '(.+)' into '(.+?)' it should work.

Signature:
Reward community members who take time to respond and help.
2 Replies
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: How to use lr_save_param_regexp() properly

Jump to solution

By default regular expressions are eager, each operator like '+' and '*' likes to eat as many characters as possible. You can make an operator more 'polite' by adding an '?' behind it.

So when you change '(.+)' into '(.+?)' it should work.

Signature:
Reward community members who take time to respond and help.
VijayKidecha Trusted Contributor.
Trusted Contributor.

Re: How to use lr_save_param_regexp() properly

Jump to solution

That worked thank you so much   JHF Remmelzwaal

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.