Highlighted
MatC Frequent Contributor.
Frequent Contributor.
1043 views

Using variable in regex param

Jump to solution

Hello,

I am trying to a parameter in my regex save function, but it is not working. It doesn't seem to evaluate as a parameter. Here is the code:

	web_reg_save_param_regexp(
		"ParamName=TestParam",
		"RegExp=([0-9]*).*>{MyParam}",
		SEARCH_FILTERS,
		"Scope=Body",
		"IgnoreRedirections=Yes",
		"RequestUrl=*/Default.aspx*",
		LAST);

I'm guessing it's because it's part of the string, but just want to be sure. Is there a good way to do this?

Thanks,

Mat

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Moshka Honored Contributor.
Honored Contributor.

Re: Using variable in regex param

Jump to solution

hi,

the regular expression string cannot conatin parameters (as the '{' and '}' chars has different meaning in regular expressions).

 

you can use the lr_eval_string to generate the RegExp=... string with the parameter and pass the generated char* as the argument.

 

Micro Focus Performance Core.
Functional Architect
your performance, our passion!
2 Replies
Moshka Honored Contributor.
Honored Contributor.

Re: Using variable in regex param

Jump to solution

hi,

the regular expression string cannot conatin parameters (as the '{' and '}' chars has different meaning in regular expressions).

 

you can use the lr_eval_string to generate the RegExp=... string with the parameter and pass the generated char* as the argument.

 

Micro Focus Performance Core.
Functional Architect
your performance, our passion!
MatC Frequent Contributor.
Frequent Contributor.

Re: Using variable in regex param

Jump to solution

Thank you. This is what I ended up doing.

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.