Validate a string
Posted
by Activist
on Stack Overflow
See other posts from Stack Overflow
or by Activist
Published on 2010-05-19T19:27:06Z
Indexed on
2010/05/19
22:10 UTC
Read the original article
Hit count: 156
JavaScript
|regex
I'm not that good with regular expressions...
I need a JavaScript regular expression that will do the following:
- The string can contain letters (upper and lower case), but not punctuations such as éàïç...
- The string can contain numbers (0..9) anywhere in the string, except on the first position.
- The string can contain underscores (_).
Valid strings:
- foo
- foo1
- foo_bar
- fooBar
Invalid strings:
- 1foo --> number as first character
- foo bar --> space
- föo --> punctuation ö
Many thanks!
© Stack Overflow or respective owner