You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expected behaviour when using a MULTILINE regex like #.*$ is that it will match a whole line that begins with #
Because crystal conflates MULTILINE and DOT_ALL, that regex will, when set to MULTILINE, match also any subsequent lines until the end of the file.
Regex.new("#.*$", Regex::Options::MULTILINE).match("# this should be matched\nthis shouldn't")
=> Regex::MatchData("# this should be matched\nthis shouldn't")
To keep backwards compatibility, the behaviour of MULTILINE in crystal should not be changed, but I propose a change that adds a new MULTILINE_ONLY flag that just doesn't set DOT_ALL when creating the underlying PCRE2 object.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: