I'm trying to parse an 8-digit string that has "2" in the first and fourth position from a larger string. I used Regex Pal to get this:
[2]\d{3}[2]\d{3}
but it does not work in Alteryx Regex. What do I need to change?
Thanks,
Ben
Solved! Go to Solution.
I believe what you want to do is create marked groups, so something like this:
([2])(\d{2})([2])(\d{4})
If the second # 2 is in the 4th position, then you'll only want 2 digits between the first instance and the second, not 3 as indicated in your RegEx Pal string.
Does this accomplish what you're looking for? Kindly mark solved if so, or let me know if additional tweaking is needed! Thanks!
NJ
Try without the brackets:
2\d{3}2\d{3}
Here is what I got:
Scratch my first response. Looking at @Joe_Mako response and then re-reading your original question, I think this might be the combination you're looking for - a parse though, not a match, and for it to pull out just the string of 8 digits from the larger string regardless of their location in the string. Getting closer? :)
Hey @kpmg_lc_analyst
Did the solutions below get you to a working outcome?
If so - would you mind marking this as solved - or if not then let's work together to iterate to a solution that works?
thank you!
Sean