Jin Kwon Jin Kwon - 1 year ago 61
Java Question

How can I match an input of not entirely digits?

What is the proper expression for checking that any input contains at least one non-digit char?

"11111111" doesn't match!
"1111111a" match!
"1111 111" match!

Answer Source

You can use the following regex where \D used for match any non-digit([^0-9]) character.


Regex explanation here

Regular expression visualization

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download