I am using regular expression. In phone validation, i have to use the "+" sign in that. How to provide the + sign in regular expression. Because + sign indicates one or more of preceding character(s). Whether i will provide like this \+
?
views:
32answers:
3
+4
A:
You need to escape it with a preceding \
like:
/^\+\d+$/
This example does only match strings that start with a +
that is followed by one or more digits.
Gumbo
2010-06-14 05:45:35
+3
A:
As a pretty much universal rule with regex engines, you can escape metacharacters with a backslash, so that while +
by itself indicates "1 or more", \+
is just a plus sign.
Marc B
2010-06-14 05:46:12