I don't think I've ever seen a "locked" question? Why is this locked?
Regex lookahead, lookbehind and atomic groups
Additionally, I'd like it unlocked. Any way to unlock it?
I don't think I've ever seen a "locked" question? Why is this locked?
Regex lookahead, lookbehind and atomic groups
Additionally, I'd like it unlocked. Any way to unlock it?
It has been a while since I locked the question. I think the main reason was that it was not tagged with a language tag, but instead of closing it as "too broad", I understood the need for such regex reference questions, and decided to wiki-lock it instead to encourage others to improve the top answer.
It kinda worked, since there are 144 linked questions to it at the moment.
Now, I notice this question has not been added to the main regex wiki yet, and it probably could benefit from being added to it.
A(?=B)
is useless and should always be written as AB
or (A)B
).
A(?=B)
is more appropriate versus those alternatives.
Commented
Mar 25, 2022 at 11:52
XA(?=B)Y
for any given X and Y, but that's not what's explained by the answer. Otherwise, the only difference I'm aware of is the grouping, which obviously can be resolved without zero-width expressions.
echo AB | grep -Po 'A(?=B)'
from which is easy to come up with actually useful scenarios - any case when you want to grep
for something that matters followed by some other pattern that's not relevant for further processing. Of course there are other ways not using lookaheads or \K
for this, but this expresses the intent most directly.
grep -o
you don't have direct control about the group selection and then it does make a difference. But IMO that's still a niche case compared to using regex in your own code, for which I don't see any value in the examples given in the fist answer.
Posts like this are locked as a community wiki/collaborative effort when they receive an excessive number of answers whose content largely overlaps. Instead of providing new answers, it's better for users to focus on improving the existing answer(s) (ideally the top answer) if they have new information to add.
In this case, the moderator who locked the question probably felt the existing answer does a far better job at comprehensively answering it than multiple fragmented answers would (keep in mind that is exactly the ideal model for asking & answering on Stack Overflow: where the best answer rises to the top and continues to get edited with new information as time goes on, and other, old answers are discarded).
It is unlikely that you will get the question unlocked given that it has been locked for 4 years and it's clear from the answer's history that other users have no difficulty with providing edits to improve it. At the very least, I expect you would need to provide some evidence here to back up your request for unlocking it (moderators don't unlock questions just because someone asks--there needs to be a compelling reason).