The example on http://www.exampledepot.com/egs/java.util.regex/Line.html gives false for me twice but should'nt! Why?
CharSequence inputStr = "abc\ndef";
String patternStr = "abc$";
// Compile with multiline enabled
Pattern pattern = Pattern.compile(patternStr, Pattern.MULTILINE);
Matcher matcher = pattern.matcher(inputStr);
boolean matchFound = matcher.find(); // true
// Use an inline modifier to enable multiline mode
matchFound = pattern.matches(".*abc$.*", "abc\r\ndef"); // false
System.out.println(matchFound); // false
matchFound = pattern.matches("(?m).*abc$.*", "abc\r\ndef"); // true
System.out.println(matchFound);// false !!!!!
Well, if I put an additionally (?s) it works, but shouldn't it work without the (?s)? Did this behaviour change in the past or didn't the authors simply check there example?