Yesspacesmightbeuseful.
Pattern.COMMENTS
mode lets you put whitespace in a regular expression.
The whitespace will be ignored.
For example,
Pattern pattern = Pattern.compile( " ant | bat | cat | dog ", Pattern.CASE_INSENSITIVE | Pattern.COMMENTS );
matches "ant" or "bat" or "cat" or "dog" (any mix of upper and lower case). It will not match the strings " ant " or " ant" or similar. The spaces in the regular expression make it easier to read, but are not really part of it.
Use this feature with caution.
Create a Pattern
that matches q, Q,
Quit, quit, QuiT, ...