Multiline match mode for regex managers #30170
satwell
started this conversation in
Suggest an Idea
Replies: 1 comment 2 replies
-
In the short term, I think clarification in the docs would be helpful. Instead of just telling users to "be aware when using
I was about to submit a PR for the docs, but then realized I'd have to sign the CLA, which is not permitted by my employment contract. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tell us more.
Would it be possible for regex manager to use multi-line mode (the
m
flag for regular expressions) when applying the regular expressions inmatchStrings
? This would let users use^
and$
to anchor to lines instead of the whole file.It's handy for many syntaxes to match on line boundaries. E.g., to avoid matches in line-level comments. It's possible to get the same behavior by using
(?:^|\r\n|\r|\n)
to match line beginnings and(?:$|\r\n|\r|\n)
to match line ends. But this makes the regexes much messier.I think the behavior of
^
and$
only matching file beginning and end can trip up new users when trying to figure out this already complex feature (example). It certainly tripped me up, even though I'd read the docs where they say:I initially interpreted this as "we use multi-line mode so be aware that
^
and$
will match line boundaries within the file" because it seems like obviously desirable behavior, although I realize now that this was incorrect.Beta Was this translation helpful? Give feedback.
All reactions