regex_match - Can it read and compare information that sits in parentheses?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey guys,
I noticed something odd and I wanted to pick your minds on it.
I have a part of the flow that has literally one thing to do which is check whether there is a change between 2 values for a Position title.
The position title that appears to be giving the flow a bit of hassle is: Legal Counsel (Data Privacy)
When comparing the title between the fields with a regex_match, the formula returns a need for a change, as if the titles are not matching, although they are.
If we are checking the change without a regex_match and just by simply saying if [externalName.defaultValue]=[New Position title] then "No Change" else "Change" endif then it shows us that there is no need for a change.
Am I missing something or is there a limitation with the "(" / parentheses under regex_match ?
Happy to read your views.
Cheers!
Solved! Go to Solution.
- Labels:
- Preparation
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Misulici what is the regex formula used for the comparison? also, can you check the data type of these two fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@binuacs I've used
if regex_match([New Position title],[externalName.defaultValue],0) then "No Change" else "Change" endif.
The string type in both situations is "V_WString"
Maybe I am missing something in the way I am writing the formula.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The regex_match function compares a string to a regular expression pattern, but based on your statement, it seems you're trying to check if the two fields are equal. The parentheses (( and )) in Legal Counsel (Data Privacy) are special characters in regular expressions, meaning they are treated as group delimiters rather than literal characters. Unless escaped, the regex_match function will fail to match these characters literally. if you still wanted to use the regex_match for comparison you need to replace all ( and ) with \( and \)in the second string
regex_match("Legal Counsel (Data Privacy)", "Legal Counsel \\(Data Privacy\\)", 0)
if regex_match([New Position title], Replace(Replace([externalName.defaultValue],'(','\('),')','\)'), 0) then "No Change" else "Change" endif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@binuacs oh dear. I totally forgot about this.
Thank you lots for noticing this!
I would only need an idea on how to apply this generally, though. The current formula that is being used, in order to make the comparison is "regex_match([New Position title],[externalName.defaultValue],0)". Any idea on how I could escape the parentheses in this scenario? Am asking since the formula would validate at a bulk level and other occurrences with parentheses might appear, while others will not have.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so so much! It worked! 💓
