Find ^$ under the regex MULTILINE flag applied to a string that can be empty

Proprietary

Under MULTILINE, ^ does not match at the end of the input, so ^$ finds nothing in an empty string. Marks the pattern argument of Pattern.compile when the regular expression is ^$, alone, as a whole alternative, or wrapped in groups with nothing beside it, MULTILINE is in effect through Pattern.MULTILINE or an inline (?m), and the pattern is used as matcher(x).find() on a string that can be empty. The pattern can be used directly or held in a variable or field. The pattern argument of String.replaceAll and String.replaceFirst is marked the same way when the string they are called on can be empty. A string can be empty when it is the literal "", or a parameter or local variable on which isEmpty() is never called. A field, a method call result or any other expression counts as not empty. A pattern that is not a string literal, a flags argument that is more than literals and Pattern constants joined by | or +, a pattern that turns MULTILINE off inline, a pattern that sets (?x) inline, and a pattern holding a # under Pattern.COMMENTS are skipped, and so is ^\s*$. Test sources are not searched.

io.moderne.staticanalysis.FindEmptyLineTestWithMultiline
mod run . --recipe=io.moderne.staticanalysis.FindEmptyLineTestWithMultiline

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.