Is there a regex which accepts any symbol?
EDIT: To clarify what I'm looking for.. I want to build a regex which will accept ANY number of whitespaces and the it must contain atleast 1 symbol (e.g , . " ' $ £ etc.) or (not exclusive or) at least 1 character.
Yes. The dot (.
) will match any symbol, at least if you use it in conjunction with Pattern.DOTALL
flag (otherwise it won't match new-line characters). From the docs:
In dotall mode, the expression . matches any character, including a line terminator. By default this expression does not match line terminators.
Regarding your edit:
I want to build a regex which will accept ANY number of whitespaces and the it must contain atleast 1 symbol (e.g , . " ' $ £ etc.) or (not exclusive or) at least 1 character.
Here is a suggestion:
\s*\S+
\s*
any number of whitespace characters\S+
one or more ("at least one") non-whitespace character.