simple javascript regex question -
How do I match the following method?
"Anything 123.anythingelse"
Any letter of length, with exactly 1 "." In the middle, and then any length of alphanum?
Thank you.
That would be / [a-z0- 9] + \. [A-z0- 9] + / i
. The / i
case is the insensitive modifier.
var match = /[a-z0-9]+\.[a-z0-9]+/i .test (string); Warning (match); // right or wrong.
If you can allow underscores, it can be reduced: / \ w + \. W + /
. \ w
is the same as [a-zA-Z0-9_]
.
See also :
Comments
Post a Comment