Is there any way of anchoring regex by beginning and ending of selections? #14438
Unanswered
TaylorRichberger
asked this question in
Q&A
Replies: 1 comment
-
Ideally this would be supported by |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I have, for example, a json file:
And I have a selection encompassing each of the keys. I want to filter to just the keys that match the entire regex
^[a-z]+--[a-z]+$
. Unfortunately,^
and$
only match the beginning and ending of lines, not selections. If I do[a-z]+--[a-z]+
, it keeps thezeta--eta--
line, which I don't want.I know I can select the surrounding quotes too in this case, but I think in general, it would be useful to be able to use
keep_selections
andremove_selections
with a regex that matches against the beginning, ending, or entire selection via some selection-specific anchor, if not^
and$
, or\A
and\z
. I realize this might not be possible, due to deferring the regex processing to the regex crate, but I was wondering if anybody had any specific workarounds for this kind of editing action?Beta Was this translation helpful? Give feedback.
All reactions