且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Groovy中将字符串与模式匹配

更新时间:2022-10-19 23:23:59

(?s) ignores line breaks for .* (DOTALL) and the regexp there means a full match. so with ==~ as shortcut it's:

if ("bla bla errors found:\nhehe Aborting now\n hehe" ==~ /(?s).*errors.*/) ...