I have two strings (A and B) and uncertain lenght sub-string are concated by "," and I want to compare these two strings to see if any sub-string is matching between Strings A and B. Below is sample data for input and desired output.
Can someone help me with a RegEx for this purpose? Thank you very much.
| A | B | Answer |
| 1,2,3,4 | 2,3,5 | Y |
| 1,2,3,4 | 5,6,7 | N |
| 1,2,3 | 2,5,7 | Y |
Solved! Go to Solution.
@Qiu Regex capturing and backreference will help in this case.
(1) To make Regex simpler, create concatenated string for this purpose. Tip here is to enclose all numbers by ",". (See field 'ConcatString')
(2) Use Regex_Match with following condition: \1 means the same pattern as captured by (\d+)
REGEX_Match([ConcatString], ".*\,(\d+)\,.*_.*\,\1\,.*")
@gawa
This is nice. I was expecting you to answer my question. 😁
Thank you very much.
