Highlighted
Absent Member.
Absent Member.
250 views

How to use RegEx in C&S function using parameter

I am using Ajax Click & Script. I need to click a link that has a Text property that I obtain through a web_reg_save_param() call. The problem is, the parameter (e.g. parameter1) captures only contains the first set of characters, but I don’t have a way to determine the end of the string.

E.g. I know the text link I want to click is “ABCD X” where X is unknown to me but {parameter1} contains “ABCD”.

So I tried this:

web_text_link("LinkName",
DESCRIPTION,
"Text/RE=^{parameter1}.*",
ACTION,
"UserAction=Click",
LAST);

But VuGen complains =”^{parameter1}.*”not found.

The documentation for parameterizing Click & Script functions states the entire right side of the equal sign must be a parameter. So I tried this:

lr_param_sprintf ("parameter2", "^%s.*", lr_eval_string("{parameter1}"));
lr_output_message ("pPartDetalLink: %s", lr_eval_string("{pPartDetalLink}"));

Sure enough, parameter2 now contains “^ABCD.*”

So I then tried:

web_text_link("LinkName",
DESCRIPTION,
"Text/RE={parameter2}",
ACTION,
"UserAction=Click",
LAST);

Now VuGen complains “^ABCD.*” not found (so it did resolve the parameter’s content, but failed to see the string as a regular expression despite the /RE option).

I never have a RegEx problem with literal text, or if the entire right side is a parameter but without the /RE.

Any ideas out there?
Nicholas T Pappas
Corporate Information Technology
Raytheon Company

+1 972.205.7605 (office)
+1 214-404-8888 (cell)
+1 214-517-9299 (pager)
+1 972-205-5757 (fax)
808.7605 (tie line)
nick_pappas@raytheon.com

1200 South Jupiter Road
Garland, TX 75042 USA
www.raytheon.com
0 Likes
2 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: How to use RegEx in C&S function using parameter

Hi,

RegExp can be set as below.
"Text/RE=ABCD[A-Za-z]"

Not sure on the parameter based RegExp.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to use RegEx in C&S function using parameter

I understnad how to use a RegEx with literal text string, and I can use a paramter if I don't specify a RegEx (/RE text flag). But I need to do both...
Nicholas T Pappas
Corporate Information Technology
Raytheon Company

+1 972.205.7605 (office)
+1 214-404-8888 (cell)
+1 214-517-9299 (pager)
+1 972-205-5757 (fax)
808.7605 (tie line)
nick_pappas@raytheon.com

1200 South Jupiter Road
Garland, TX 75042 USA
www.raytheon.com
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.