I need a regex to match ASCII non-alphanumeric characters. The regex should not match non-ASCII characters. I am using the following:
"[\\u0000-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007f]"
Can I simplify this regex ?
Yes you can use a character class intersection. Example:
[\\p{ASCII}&&\\P{Alnum}]
This means: intersection between all ascii characters and all non alphanumeric characters
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