Hi,
I am new to Alteryx.. I have a use case to check if the phone number is 10 or 11 digits then it should be in (xxx)-xxx-xxxx format. If it is, make the result "Pass", else "Fail". I am not sure how to achieve this. can someone help on this?
Solved! Go to Solution.
Hey @sucansa
This could be a case for the RegEx tool and the "Match" function. Can determine a pattern - in this case:
\(\d{3}\)-\d{3}-\d{4}
Which looks for 3 digits in parentheses, 3 digits, then 4 digits all separated by the dash. If a match is found it outputs "True", else "False". You could modify this a bit if you also wanted to check for a potential 11th digit.
Sample workflow attached
Just to clarify, are you asking to find a series of numbers that are either 10 or 11 digits that you need to format like (XXX) XXX-XXXX?
or
Are you looking for (XXX) XXX-XXXX where they are all numbers?
Hi Sucansa,
This is a Regex task - which is complicated for many of us!
I've had to Google this myself, but looks like the expression you're looking for is:
^(1\s?)?((\([0-9]{3}\))|[0-9]{3})[\s\-]?[\0-9]{3}[\s\-]?[0-9]{4}$
All you have to do is paste this in a Regex tool, choose the output as "Match" and the Regex will validate the format. I'm attaching a packaged workflow as an example for you.
Regards,
Tom
User | Count |
---|---|
18 | |
14 | |
13 | |
9 | |
8 |