/
^ # begin
\s*# some empty spaces
(?:
\+? # + symbol
\d{1,2} # country code
\s*
(?(?=\)) # if followed by parens
| # then dash not allowed
-? # else optional dash
)
)? #prefix like +380
\s*
(?:
(?P<leftparen>\()? # optional left paren
\s*
0\d\d
\s*
(?(leftparen)\)|) # right paren if and only if left paren
)? # operator code, starting with 0, optinally in parentheses
(?(?<=\)) # if preceded by parens
\s*| # then dash not allowed
\s*-?\s* # else optional dash
)
(?:
\d |
(?<=
\d
)
(?(sep)
(?P=sep)|
(?P<sep>[\-\/\ ])
)
(?=
\d
)
){5,13}
\s*# some empty spaces
$ # end
#\d\d\d (?P<separator>-?) \d\d (?P=separator) \d\d $
/
mgx