Can you have multiple validation regrex formats?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 08:12 AM - edited 10-23-2024 08:33 AM
I want to include international numbers for the phone number field and allow if the number +1 is included. so the regrex I have now is ^\+?[1-9]\d{0,2}[-. ]?\(?\d{1,4}?\)?[-. ]?\d{1,4}[-. ]?\d{1,9}$
However some testers are using manually created user accounts to test and the profiles have numbers with spaces like (303) 748-9843. Am I able to include another format to include spaces or can i use one regrex that can account for spaces and non space telephone numbers? I'm not familiar with this feature and I've looked up a few and it doesn't specify having more than one or include both spaces and non spaces.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 09:08 AM
Hi @DevtoSME,
I have rebuilt your regex to validate a few more examples, here's the regex:
^\+?[1-9]\d{0,2}[-. ]?\(?\d{1,4}\)?[-. ]?\d{1,4}[-. ]?\d{1,9}$
The pattern will allow numbers like this:
+1 (303) 748-9843
+44 20 7946 0958
(303) 748-9843
303 748 9843
303-748-9843
303.748.9843
You can use this website https://regexr.com/ to validate your regex expression against the text above (do not paste them all, it will test only one per time)
Let me know how it goes.
If you found my answer helpful or correct ✔️ in any way, please don't forget to mark it to help future readers! 👍
--
Kind regards,
Marcos Kassak
Solution Consultant 🎯
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 12:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 12:18 PM
Hi @DevtoSME,
I have created one specific for (303) 748-9843 to keep it simple, please test:
^\(\d{3}\) \d{3}-\d{4}$
The output from the site confirming that worked:
If you need more scenarios we can adapt again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 05:41 AM
Hi Marcos thank you fro your reply however the original ask was for international numbers to be included .
so all formats included space and no spaces PLUS +1 is what I'm looking for, is there a regrex for that?
+1 (303) 748-9843
+44 20 7946 0958
(303) 748-9843
(303) 748 9843
303 748 9843
303-748-9843
303.748.9843