This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Not replacing regex matches with lookbehinds/lookaheads (possible bug?) #25161
ChristyKail
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I've been trying to use atom to insert a string into various elements of an XML file and came across a weird issue.
If I search for my REGEX it shows a number of matches, but when I enter the text I want to replace it with and click replace all, I get an error sound, and the number of matches switches to zero. Clicking FInd or Find all will also then display no matches until I edit the REGEX and try again.
I've played around a bit and this seems to happen with any REGEX that contains a lookbehind/lookahead. I know lookbehinds weren't initially supported in Atom, but given it shows me matches to begin with I'm a bit confused as to why it won't replace them. The result of my specific REGEX is zero-length, but I've tested with other zero-length matches and don't have an issue.
The exact things I'm trying:
Input text:
2022-04-06T14:21:42+00:00
Regular expression:
(?<=\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2})
Replace string:
.000001
Expected result:
2022-04-06T14:21:42.000001+00:00
This works exactly as expected in Sublime Text, BBEdit, and PyCharm
Beta Was this translation helpful? Give feedback.
All reactions