Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Regex

CalDowd98
8 - Asteroid

Hi Community,

 

I have a string of address data where im trying to pull out the first number from it. EG 23 Caldowd98 Road, i'd like to pull out the 23, the first number.

 

Is there a Regex funtion out there that will allow me to do this ? Thank you !

13 REPLIES 13
CalDowd98
8 - Asteroid

Awesome that works perfect !

 

Thanks

JokeFun
8 - Asteroid

@Jonathan-Sherman Hi Jonathan, would you please help me understand the codes of below?

?.*

(^|\s)

(.*?)

T_Willins
14 - Magnetar
14 - Magnetar

Hi @JokeFun,

 

It is difficult to see in the expression, but there is a space before the ?.*    Alteryx allows a space, but I usually use \s instead as it makes the expression clearer.  So this is really two separate parts of the expression:

\s?    find the first whitespace character

.*       match everything (until the named group that follows)

 

(^|\s)      ^    beginning of line

              |     or

             \s    whitespace character

 

So the second RegEx is finding where from the beginning of the line or after a space find the word APT or FLAT or APARTMENT or Suite (all case insensitive) followed by any characters until followed by a digit or a word.  If that specific pattern is found, then replace it with blank.

 

(.*?)  in the third RegEx is a named group to find all characters until the next part of the RegEx expression.  In this case find all characters until the next named group which is one or more digits followed by a single word character if there is one

 

For more information on Perl syntax, I find this Alteryx Community link to be helpful:  

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/RegEx-Perl-Syntax-Guide/ta-p/1288

 

 

JokeFun
8 - Asteroid

@T_Willins Very grateful of this! Thank you!

Labels