DOTALL for String.matches()

后端 未结 1 1182
感动是毒
感动是毒 2021-02-19 02:00

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 mo

相关标签:
1条回答
  • 2021-02-19 02:38

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

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

    Here's the Javadoc.

    0 讨论(0)
提交回复
热议问题