I want a regex pattern to check that the string doesn't contain any digits .
For Illustration : I'm coding a Hospital System and I want from user to enter the name of the patient , Of course the name shouldn't contain any digits , how can I do this by Regex ?
\D
is a non-digit, and so then \D*
is any number of non-digits in a row. So your whole string should match \D*
.
\A\D*\Z
a good regex cheatsheet here
Try: \D
See the JavaDoc for Pattern
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With