I am trying to create a validation rule for phone number and using the following regex Validation :

NOT(REGEX( Phone, "^(?=.*?[1-9])[0-9()/\\-\\+\\s\\.\\ ]+$"))

The above regex is working fine if user is manually typing the Phone number. But getting error, if he copy and pasted in the field (Seems like hidden characters in place of spaces).

When I copy pasted the phone number in Notepad++ :

  • Phone Number format: +44 20 3739 5134 (Encode in ANSI)

  • Phone Number format: +44xA020xA03739xA05134 (Encode in UTF-8)

How to resolve this ?

  • 1
    probably better in stackoverflow – cropredy May 21 at 19:01

That's an editor-dependent problem. 0+00A0 (e.g. xA0 or " ") is a "no-break" space, while 0+0020 (e.g. x20 or " ") is a "normal" space. Depending on where you're copying from, that can definitely cause issues. Technically, \s should also match the no-break space, as far as I'm aware. You may want to open a case with support.

Not the answer you're looking for? Browse other questions tagged or ask your own question.