I've used trial and error on this and even RTFM, but I can't figure out how to solve this RegEx problem. It seems extremely simple but I've reached the hubris threshold and actually need a solution.
Problem:
I need to match all of the strings that contain a range of characters. In the example below, I need to find all of the strings that only contain letters a through d.
Constraint:
I want to put this in a macro that would accept the last character and the Action would change only the last letter in the range. Therefore, RegEx that specifies each character won't work for my need.
Current Attempt:
I've tried various combinations of the following:
REGEX_Match([Testval], "[a-d]")
REGEX_Match([Testval], "^[a-d]")
REGEX_Match([Testval], "/[a-d]/")
and all of them return zero records.
Extra Credit:
Ideally, I'd also love to have a RegEx that would allow me to match all of the records where each character in that range only appeared once. (e.g. match abcd, but not aabd)
I've attached a test workflow and would love your help in soving this problem.
Thanks!
Solved! Go to Solution.
For your original problem, add a * to the end of your first attempt: REGEX_Match([Testval], "[a-d]*"). For extra credit, I will give it some more thought.
@MarqueeCrew beat me to it! Here is the one line similar to your current Regex that will make sure there are no repeating characters:
REGEX_Match([Field1], "(?:([a-d])(?!.*\1))*")
Here is the regex tester to explain it.
Outstanding Patrick! Thank you!