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 !
Solved! Go to Solution.
Awesome that works perfect !
Thanks
@Jonathan-Sherman Hi Jonathan, would you please help me understand the codes of below?
?.*
(^|\s)
(.*?)
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
@T_Willins Very grateful of this! Thank you!