Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

split string with string


Is there a method to split a string with a string? For example if I have "Johnny #1-15 Nevada State XYZ", could i use something like RegEx to parse the string using "Nevada State" and return "Johnny #1-15", and "XYZ"? Really only the first part is requeired but I imagine both would be returned if parsing is the trick. There are several example that tiptoe around this online but nothing that I have seen using a defined string to do this. In this case characters on the end, or right are inconsistent and there are no consistent special characters to utilize. Also note worthy is there is not always a number at the end of the first parse. 




I don't see any direct way.  The Text to Columns tool will treat each character as a delimiter and give strange results, and the RegEx tool would only extract "Nevada State".

Probably the best option would be to use a Replace() function to replace the text with a particular delimiter (maybe | since that's likely to be unique), that you use later in the Text to Columns tool.

Stephen Ruhl
Customer Support Engineer

ACE Emeritus
ACE Emeritus

If you know that "Nevada State" always comes across, here's a screenshot of a RegEx tool configuration that will work.






Example output



Alteryx Partner

You could also do this in a regular formula, but is the delimiter always "Nevada State" or does that change per record ?