I'm trying to come up with a regex expression that matches a string that has only non-alphanumic characters.
For example:
".."
would betrue
".dds!f"
would befalse
- and
"sdjhgfsjd"
would befalse
.
I have tried str.matches("\\p{Punct}")
however this only seems to match single punctionation characters. eg. ".".matches("\\p{Punct}")
would be true but "..".matches("\\p{Punct}")
would be false.
I suppose an equivalent question would also be to match if there is any alphanumeric character in the string.