Hello community
I have following regex that should validate phone number format
regex
((\(\d{1,3}\))|(\(\+\d{1,3}\))|\+\d{1,3})\s?\d{3}(\s?)|-?\d{3}(\s?)|-?\d{3}
allowed formats should be this
dataset:
+123 777 123 456
(123)777-123-456
(+123)777-123 456
+123777123456
+123 777 12 34 56
+(123 777 123 456
(+123 777 123 456
in regex validators like https://regex101.com/ or https://regexr.com/ it is OK, but for alteryx throws me different results
and alteryx result
WF with input dataset in attachment
P.S. optimalization is bonus :D)
Solved! Go to Solution.
HI @petr__ , Try this formula: \+\d{3}\s\d{3}\s\d{3}\s\d{3}\s*|\(\d{3}\)\d{3}-\d{3}-\d{3}\s*|\(\+\d{3}\)\d{3}-\d{3}\s\d{3}\s*|\+\d{12}\s*
This restricts to the 4 specific data formats you specified. If want to see more about the Alteryx Perl formatting, here is a helpful page: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/RegEx-Perl-Syntax-Guide/ta-p/1288
Let me know if you have additional questions about the formatting.
Your original expression will work with a couple of minor edits,
New regex,
((\(\d{1,3}\))|(\(\+\d{1,3}\))|\+\d{1,3})\s?\d{3}(\s|-)?\d{3}(\s|-)?\d{3}
Hello guys,
thanks both for regex 🙂
@T_WillinsI used your regex 🙂
@PhilipManneringunfortunattelly 'new regex does not work',
but my question is same, why some regex does not work in alteryx but other validator accept it ?