Javascript RegEx for Global phone numbers -
Javascript RegEx for Global phone numbers -
i browsing through net find proper javascript regular look phone numbers ones find not ones need.
the acceptable phone number type case have match next rules:
may start+
or 0-9
all rest string allowed have 0-9
, -
, space (preferably 1 space between numbers) i tried far this: /^\+[\-\d\s]/
not getting proper result. i've tried read tutorials new , seems missing something.
an acceptable phone number illustration be: +30 6995 4488551 (spaces allowed) or 0030 6995 4488551 etc.
any help much appreciated! :)
your regex matches starts +
followed single -
, digit or whitespace character. match example:
i suggest @ examples , tutorials on http://www.regular-expressions.info/. telephone numbers improve regex be:
/^\+?[\d -]+$/
this match valid numbers invalid constructions +---------
or +
trailing space. if want close denying lot of invalid combinations suggest read this, can see regexes messy.
javascript regex
Comments
Post a Comment