I have written a regex pattern with positive look-behind in python
which matches a comma-separated list of mobile numbers. The pattern is:
^\+?[0-9]+((,?)(?(1)(\+?[0-9]+)))*$
It matches any mobile number regarding following constraints:
- Each phone number can start with
+
; any other+
characters are forbidden. - Each phone number can start with
00
. - Spaces are not acceptable; not middle spaces nor peripherals.
My pattern works fine in python
, but I want to convert it to javascript
version in order to use it in an angular
project.
I googled about javascript look-behind regex, but I couldn't figure out how to make use of indexed look-behind in javascript
; the ?(1)
part.
Is there any way to convert this python
regex to javascript
or any other equivalent regex to match my needs?