Hello Everyone, I am attempting to add a hyphen to an array of strings within my data.
In other words,I need to randomly introduce a hyphen to some fields of medications based on their alphabetical sequence.
Some medications start with "ei", hence I have to place a hyphen after the "i". Hence, I need the field to look like this (excluding the quotes) "ei-dxph"
Medication Name | Condition | Expected Results |
eidxph | Hyphen after " ei " | ei-dxph |
daxph | Hyphen after "d" | d-axph |
oexph | Hyphen after "oe" | oe-xph |
9yvhpk | Hyphen after "number and Letter" | 9y-vhpk |
fhyqx | Hyphen after " f " | f-hyqx |
Solved! Go to Solution.
Here's my solution.
I generated a list of prefixes that need to have hyphens added behind them. Then, I used Find Replace with "beginning of string" setting to replace these prefixes with themselves but with an added hyphen.
Great! If you always know what the text will be that needs to be parsed then the Find Replace is perfect, if not and it needs to be more dynamic, use RegEx
Thanks! I thought regex would be better too, but I couldn't find a way to apply regex replace at just the beginning of the string. Your use of regex parse solves the problem.
Thanks for the quick feedback Anthony!
Unfortunately, my version of alteryx is not up to date (company has to update it for us). Would you mind displaying a screenshot of the solution if possible?