How to check for special character and number using regex? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to check for special character and number using regex?

How do I check if the string contains only " 0 to 9" and other special character like + - * / ( ) { } [ ] in java? i want to use regex to check this.

15th Aug 2018, 11:28 AM
RanjOyHunTer
RanjOyHunTer - avatar
1 Answer
0
[^A-Za-z] if you want include all special characters and numbers [!#$%^&*(),.?":{}|<>0-9] if you want specified special characters. for example this regexp does not contain @ or ¥.
15th Aug 2018, 12:31 PM
null
null - avatar