void () { String text = """ package com.intellij.demo; """; for(int i = 0; i < 10; ++i) text += text; text += "public class Foo {}"; FindModel findModel = FindManagerTestUtils.configureFindModel("package((?:\\n|.)+)class (\\w+)"); findModel.setRegularExpressions(true); FindResult findResult = myFindManager.findString(text, 0, findModel, null); assertTrue(findResult.isStringFound()); findModel = FindManagerTestUtils.configureFindModel("package((.|\\n)+)class (\\w+)"); findModel.setRegularExpressions(true); findResult = myFindManager.findString(text, 0, findModel, null); assertTrue(findResult.isStringFound()); findModel = FindManagerTestUtils.configureFindModel("package(([^\\n]|\\n)+)class (\\w+)"); findModel.setRegularExpressions(true); findResult = myFindManager.findString(text, 0, findModel, null); assertFalse(findResult.isStringFound()); // SOE, no match }