Highlighted
Senior Member.
81 views

My regex correlation still captures unwanted data even if I have assertion

     web_reg_save_param_regexp(
        "ParamName=c_NotPostSubTimesheet",
        "RegExp=(?<=\"StartDate\":\")([^\"]+)\"(?=.*\"Submitted\":\"[NM]\")",
        "NotFound=warning",
        "Ordinal=All",
        "Group=0",
        SEARCH_FILTERS,
        "Scope=BODY",
        LAST);

This is the JSON where I am trying to apply the assertion:

"StartDate":"2023-10-18","Architectural","Submitted":"N","StatusDesc":"In Progress","Editable":"Y"},{
"StartDate":"2021-01-01","Architectural","Submitted":"Y","StatusDesc":"Submitted","Editable":"Y"},{
"StartDate":"2020-01-01","Architectural","Submitted":"M","StatusDesc":"Missing","Editable":"Y"},{

I only want to extract the StartDate of records with Submitted value of N or M only but when I execute Vugen all StartDate values are captured including the record with Submitted value of Y.

Expected should be:

2023-10-18

2020-01-01

 

 

Labels (2)
Tags (1)
0 Likes
1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi @tiratirador , a good website to test your regexp is regex101.com (but yours is valid).

One remarks about your regexp: You do not need to use look-ahead around for a simple match. Just the pattern

"StartDate":"([^\"]+)".*"Submitted":"[NM]"

will be fine.

Check again the help on web_reg_save_param_regexp(). It states that the default group=1 and that is all you need. group=0, is not what you want.

Signature:
Reward community members who take time to respond and help.
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.