Closed ralsina closed 3 weeks ago
Some previous discussion was here: https://github.com/crystal-lang/crystal/issues/8062
Indeed it's sad that DOTALL is bunched together with MULTILINE.
/(?m)#.*$/
achieves the desired behavior of just MULTILINE, by the way - confusingly it's totally different from /#.*$/m
Bug Report
The expected behaviour when using a
MULTILINE
regex like#.*$
is that it will match a whole line that begins with#
Because crystal conflates
MULTILINE
andDOT_ALL
, that regex will, when set toMULTILINE
, match also any subsequent lines until the end of the file.To keep backwards compatibility, the behaviour of
MULTILINE
in crystal should not be changed, but I propose a change that adds a newMULTILINE_ONLY
flag that just doesn't setDOT_ALL
when creating the underlying PCRE2 object.