Hi All,
Is there a way to use
Java Regex to count number of non alphanumeric characters in the
String.
For example:
a1b2c3$3# should return 2
I have something like this:
Pattern p = Pattern.compile(".*\\W+.*");
Matcher m = p.matcher(
test);
But this returns if String contains non alphanumeric characters and not the count.
Any help or suggestion is appreciated.
Thanks,
Aditya