Hello All,
I would like to write a REGEX replace or substring function in Alteryx but I am struggling hard.
Condition: Wherever it sees 3rd dot in the string, It should eliminate the string after it.
Example shown below
My input data looks like
Id.2.7.1
Id.2.7.2
Id.2.7.3
Id.3.1
Id.3.2
Output data should be
Id.2.7
Id.2.7
Id.2.7
Id.3.1
Id.3.2
Thanks
Solved! Go to Solution.
Hey @namitajuneja,
Bit of a scary looking regex match but this works:
([^.]+\.[^.]+\.[^.]+)
It matches with one or more non . characters, then a . then one or more non . then a . one or more non . characters. Or to put it another way:
[^.]+
Captures everything before a point
\.
Captures a point.
If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...
Any questions or issues please ask
Ira Watt
Technical Consultant
Watt@Bulien.com
If you wanted to avoid RegEx then you could go down a route like this. The number conversion automatically trims anything off after the first 'decimal' as it reads it here. This approach is obviously only appropriate if your ID numbers follow similar format to what you have provided in the example.
Thank you so much.
It was very helpful.
User | Count |
---|---|
52 | |
27 | |
25 | |
24 | |
21 |