Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Perl expression format checking broken with latest release!

8 years 10 months ago #277449 by paul_mcdonald
Hello, I have had Perl Regular expression checking for fields such as Phone Numbers working for many releases. This latest release has stopped them from working. Because of that, no record can be saved in the back-end. Once they are removed, all work fine.

This is what I've always used for phone number validation:
Code:
((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}

Can anyone assist with a fix?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8302
  • Karma: 1446
8 years 10 months ago #277478 by krileon
Works perfectly fine in all my tests. Ensure you've CB 2.0.13 installed. Your REGEXP is missing delimiters as well, which you must supply. The below is 1:1 more about what you should be using.

Code:
/^((\(\d{3}\) )|(\d{3}-))?\d{3}-\d{4}$/

This will match the following exactly.

111-1111
111-111-1111
(111) 111-1111

If still not working check that your browser is up to date or try a different browser as the JS regex parsing is a different engine from PHP regex parsing and an out of date browser may not be able to parse some usages. This means you need to be careful to ensure your REGEXP is JS and PHP compatible.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: nant

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum