16

I know that DOTALL is available for the fully fledged Pattern+Matcher classes.

But if I want to only use String.matches(), is there a way to tell it to use the DOTALL modifier?

ef2011
  • 10,431
  • 12
  • 49
  • 67

1 Answers1

26

You can enable it with the embedded flag (?s), as in

"\n".matches("(?s)."); // true

Here's the Javadoc.

Daniel Lubarov
  • 7,796
  • 1
  • 37
  • 56