A Regular Expression to match a non-numeric string that is not composed entirely of numbers. Useful for usernames, nicknames, unique identifiers, and more.
Note that this regular expression is different from Regular Expression To Match Non-numeric Characters, which strictly restricts numbers from appearing in strings.
/(?!^\d+$)^.+$/g
Matches:
- abc
- a123b
- abc123
Non-matches:
- 1
- 12345
- 123456
See Also:
- Regular Expression To Match Non-Alphanumeric Characters
- Regular Expression To Check Non-digit Characters
Expression Flags
Flags | Description |
---|---|
i |
Ignore case sensitive. |
g |
Allows global search. |
m |
Allows multiline search. |