[SOLVED] ensure proper formatting for phone #?

13 years 10 months ago #136816 by krileon
That is because you need to escape them. Folks this is regex 101, please review the resources found here for regex usage information. It's simply a matter of trial and error. ;)

Please try the following.

[code:1]
/\([0-9]{3}\)[ ][0-9]{3}-[0-9]{4}/
[/code:1]


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.

Please Log in to join the conversation.

13 years 10 months ago #136824 by ThePiston
thanks - i checked everywhere and spent a lot of time on it before I posted. That code doesn't work for me, unfortunately. why do you have to escape the parentheses and not the dash? Also, i assume the backslashes are supposed to disappear when you save the field?

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

13 years 10 months ago #136867 by krileon
The dash doesn't have a regex function so it does not need to be escaped. The backslashes are the regex expressions delimiter. In all regex tests the regex is valid and working, am not sure how well its usage would be in CB. Am not sure what more to advise, but the regex is correct.


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.

Please Log in to join the conversation.

13 years 10 months ago #136868 by ThePiston
ok, i finally got it - you have to escape the escapes for CB to save them properly - this is the correct code to insert into the PERL field:

[code:1]/\\([0-9]{3}\\)[ ][0-9]{3}-[0-9]{4}/[/code:1]

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

13 years 9 months ago #137345 by bulcanan
Hi I will delete the post I put out for help as its already done here. I still need help tho. what I want to do is
000-000-0000
0-000-000-0000
0 000 000 0000
0.000.000.0000

Please help

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.314 seconds

Facebook Twitter LinkedIn