Project

General

Profile

Actions

Bug #5632

closed

Javascript SyntaxError: Nothing to repeat: in regexp for phone numbers validation

Added by beat over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
03 December 2015
Due date:
% Done:

100%

Estimated time:

Description

This needs confirmation:

Saving a profile with a phone number gives:
Javascript SyntaxError: Nothing to repeat and fails validation without error message.

Pattern is:

"^([0-9](|-)?)?(\(?[0-9]{3}\)?|[0-9]{3})(|-)?([0-9]{3}(+|-)?[0-9]{4}|[a-zA-Z0-9]{7})$"

where

(+|-)?

has no backslash to escape the +

The string "+|-" can be found at various places unescaped.

correct string should be (and it does not allow area-codes in the form of (021) 123 123 123:

/^([0-9](\+|-)?)?(\(?[0-9]{3}\)?|[0-9]{3})(\+|-)?([0-9]{3}(\+|-)?[0-9]{4}|[a-zA-Z0-9]{7})$/

Additionally I saw on a site the + replaced by http-encoded spaces as follows:

/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/

In the field edit form (but once saved with the backslash-pluses it worked.


Related issues 1 (0 open1 closed)

Related to CB - Bug #5641: Multiple words with spaces validation breaks user manager save buttonsClosedkrileon08 December 2015

Actions
Actions

Also available in: Atom PDF