We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Invalid regex in alteryx but correct in regex validators?

petr__
7 - Meteor

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

petr___0-1636127591978.png

 

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

 

petr___1-1636127591990.png

 

 

 

petr___2-1636127591903.png

 

 

 

and alteryx result

 

petr___3-1636127592099.png

 

 

WF with input dataset in attachment

 

 

P.S. optimalization is bonus :D)

3 REPLIES 3
T_Willins
14 - Magnetar
14 - Magnetar

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.

PhilipMannering
16 - Nebula
16 - Nebula

Your original expression will work with a couple of minor edits,

PhilipMannering_0-1636194144260.png

 

New regex,

((\(\d{1,3}\))|(\(\+\d{1,3}\))|\+\d{1,3})\s?\d{3}(\s|-)?\d{3}(\s|-)?\d{3}

 

petr__
7 - Meteor

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 ?

 

Labels
Top Solution Authors