Search code examples
regexalteryx

Regex extract number from a string with a specific pattern in Alteryx


I have string like this which looks like a url

mainpath/path2/abc/PI 6/j

From the string I need to get the number along with PI

Main problem is the position of PI part wont be always the same. Sometimes it could be at the end. Sometimes at the middle.

So how can I get that number extracted using regex? I'm really stucked with this


Solution

  • It's as simple as using the RegEx Tool. A Regular Expression of /PI (\d+) and the Output Method of "Parse" should do the trick.

    enter image description here