0

I am using sms/mms field in sitecore for my mobile field but i already have a selection of prefix with this i need to discard the + sign on the field i have tried to use regex \d{7,8} but it seems it still accepts + sign.

Can anyone have a regex that will not accept the + signenter image description here

Pyne
  • 9
  • 4

2 Answers2

0

Try this:

^\d{7,8}$

^ and $ indicate the beginning and ending of the string.

Daniel Tran
  • 6,083
  • 12
  • 25
0

Use this regex - /^[0-9]{7, 8}$/

^ indicates that your match begins at the start of the string
[0-9] indicates that you want to match only digits
{7, 8} indicates that you want to match only 7 or 8 digits
$ indicates that your match ends at the end of the string

Raghudevan Shankar
  • 1,083
  • 9
  • 18