简体   繁体   English

DOTALL for String.matches()

[英]DOTALL for String.matches()

I know that DOTALL is available for the fully fledged Pattern+Matcher classes. 我知道DOTALL可用于完全成熟的Pattern + Matcher类。

But if I want to only use String.matches() , is there a way to tell it to use the DOTALL modifier? 但是,如果我只想使用String.matches() ,有没有办法告诉它使用DOTALL修饰符?

You can enable it with the embedded flag (?s) , as in 您可以使用嵌入式标志(?s)启用它,如下所示

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

Here's the Javadoc . 这是Javadoc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM