Gooday,
I find that my Regex is a bit rusty. Because when I tried with Regex101.com I got an other result than in Alteryx.
I'm trying to parse the underscore away and I only needs the last 2 characters.
so in this example I only need AA_FH to be FH and the AA_OUT_FH to also be FH.
In Alteryx I get this back
Did something change in the Regex tool?
Solved! Go to Solution.
The reason this won't work in Alteryx, that Regex101 doesn't show so well, is that in your second test (AA_OUT_FH), there's actually 2 matches of the pattern you're providing (i.e. an underscore followed by letters) and so when you parse it, Alteryx will just provide the first match as the output. You can see what I mean if you switch the mode to tokenize (i.e. output all matches of the pattern) - you have 2 for the second line.
To get around this, you can use a more specific expression. The following works if you just want to find the final 2 letters after the last underscore:
.+_([A-z]{2})
Thank you for the explanation,
is there an other tool like Regex101 that shows in a better way what the Alteryx regex tool will output?
The reason for the discrepancy is because you've got Case Insensitivity ticked
Use,
_([A-Z]+)$