Regular Expression ^(\+\d+\s?)?\d+$ [closed]

It requires that the string contain digits, optionally preceded by a plus sign with at least one digit and one optional whitespace character.

So 123456 would be valid (no leading +nnn), as would +123 456789 or +123456789. You must not have any spaces at the beginning or end. Letters and punctuation (other than the leading +) aren’t allowed anywhere.

Visual example on regex101

Browse More Popular Posts

Leave a Comment