Hi,
I have a field with some data in it for example
[Location]="MSY-MAINT/BAY/1"
The location field should only ever have letters, numbers, the "-" symbol or the "/" symbol and I am willing to take that risk of user error to not have the Regex ridiculously complex. The underlying ERP does a good amount of validation already.
I was trying to do a formula to capture only up to the first "/" so the desired result would be "MSY-MAINT"
This is the 4th formula I started building up after the other methods became too complex to be worth debugging. Note that I've added several qualifiers that appear to be necessary per Regex101, but adding them didn't change the behavior of the Alteryx formula. It did the same thing with or without them (this includes the + for multiple matches and the \ as an escape character).
REGEX_Replace(Uppercase([Location), "([0-9A-Za-z]+)\/(.*)","$1")
This is returning "MSY-MAINT" but it should only return "MSY" as the "-" symbol is not in the capture group. "-" is ascii code 45. Verified with RegEx101 the capture group does not include ascii 45.
regex101: build, test, and debug regex
This should be required for the result Alterxy gave to be correct of "MSY-MAINT"
REGEX_Replace(Uppercase([Locaiton]), "([0-9A-Za-z\-]+)\/(.*)","$1")
I'm sure it's something I misunderstand about Regex or the implemenation of it in Alteryx. Does anyone know why Alteryx appears to give the incorrect result for the first version of the formula?
Thanks.