• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: how to set Regex rule on phone number or textbox

how to set Regex rule on phone number or textbox 1 day 8 hours ago #44027

  • fchan
  • fchan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
Dear Sirs,

I have problem to use either phone number field or textbox field
to allow input landline and mobile phone for China, USA and European countries

Note: I have tried below methods but still cannot work
\d — digit (0-9)
\+ — plus symbol
$$ and $$ — parentheses
\s — any whitespace, including spaces and tabs

not work syntax rule :
^\+?[\d\s\-\(\)]{7,20}$
^[\d\+\(\)\s\-]+$
^[\d\+\(\)\s]+$
^[\d\+$$$$\s]+$

OR can I have a textbox field JUST do not allow to input text
any number, symbol are allowed ?



//== sample 1 ==//
+852 9123 4567
+853 6612 3456
+86 13812345678
+1 (415) 123-4567
+49 30 123456
+81-3-1234-5678
+44 20 7946 0958
020 7946 0958
123-4567

//== sample 2 ==//
+86 13812345678 ✅ plus, digits, space, valid length
+853 6612 3456 ✅ plus, digits, space, valid length
+1 (415) 123-4567 ✅ plus, digits, parens, dash, spaces
+49 30 123456 ✅ plus, digits, space
020 7946 0958 ✅ digits, spaces
123-4567 ✅ digits, dash, valid length

//== sample 2 ==//

//== sample 3 ==//

Province/City Area Code Example Landline Example Mobile
Beijing 010 +86 010-87654321 +86 13912345678
Shanghai 021 +86 021-23456789 +86 13823456789
Guangzhou (GD) 020 +86 020-59786543 +86 13798765432
Shenzhen (GD) 0755 +86 0755-12345678 +86 18633332222
Hangzhou (ZJ) 0571 +86 0571-55667788 +86 15888889999
Nanjing (JS) 025 +86 025-44112233 +86 15122223333
Chengdu (SC) 028 +86 028-33445566 +86 15523456789
Wuhan (HB) 027 +86 027-77889900 +86 15998761234
Xi'an (SN) 029 +86 029-55667788 +86 17765432109
Chongqing 023 +86 023-77889900 +86 19912341234
Tianjin 022 +86 022-33445566 +86 18832176543
Shenyang (LN) 024 +86 024-55778866 +86 13399887766
Harbin (HLJ) 0451 +86 0451-33445566 +86 13111112222
Changsha (HN) 0731 +86 0731-76543210 +86 18987654321
Jinan (SD) 0531 +86 0531-66778899 +86 17898765432
Qingdao (SD) 0532 +86 0532-11223344 +86 18660123456
Kunming (YN) 0871 +86 0871-76543210 +86 13508715678
Urumqi (XJ) 0991 +86 0991-33445566 +86 13609911234
Lhasa (XZ) 0891 +86 0891-88992211 +86 13908911234

Thanks indeed
The administrator has disabled public write access.

how to set Regex rule on phone number or textbox 1 day 7 hours ago #44028

  • fchan
  • fchan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
Dear Sirs,

I SOLVED this question. Thanks for your kind attention, Let me share what I have done.

1. use textbox field (not phone number field)
2. Validation Rule : Regex
3. Regex Syntax : /^[\d\+\(\)\s\-]+$/

Then, I can input below different type of mobile
1. +86 0532-11223344 China landline Qingdao (SD)
2 +86 13798765432 China mobile Guangzhou
3. +44 20 7946 0958 United Kingdom
4. +1 (415) 123-4567 USA
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!