The following will match any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character
/^[a-zA-Z\$_][a-zA-Z0-9]*/
The following is a example in Javascript
alert(/^[a-zA-Z\$_][a-zA-Z0-9]*/.test("testVar"));
3 comments:
Small correction. This will not match any Unicode letters since you've specified a subset of ASCII :-)
Thanks Chintana for the correction.
To simplify and correct the regex it can be written as
/^[\w\$][\w]*/
Since Firefox regex engine doesn't know Unicode \w is equivalent to [a-zA-Z0-9_]
I like your blog. Thank you. They are really great .
Some new style Puma Cat shoes is in fashion this year.
The Nike Air Shoes is a best Air Shoes .
Nike Air Rift is good and Cheap Nike Shoes.
If you are a fans of Puma basket,we would offer the good and Cheap Puma Shoes for you .the cheap ugg bootsis best christmas gift now.
The information age is really convenient .
Post a Comment