EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Ignore \r in regex
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
Deipotent
Posted on: 8/25/2011 9:46 am
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Ignore \r in regex
After thinking about this again, I re-looked at the regex in my linked post for finding duplicate lines, and realised that there appears to a bug in EmEditor's regex parser.

My suggestion for ignoring \r already appears to be implemented. Let me give some examples to explain:

1) Even if EmEditor didn't ignore \r, the following regex should work as the part, "\r?", is saying match zero or one occurrences of \r. So it should match whether there is a \r or not. But it doesn't.

^(.*)(\r?\n\1)+$


2) However, if you remove the '?', so the regex becomes as follows, it works, and matches duplicate lines:

^(.*)(\r\n\1)+$


3) It also works if you have the original regex, but replace "\r" with "(\r)":

^(.*)((\r)?\n\1)+$



So, the bug appears to be that EmEditor seems to have a problem applying '?', when it follows a \r. It already seems to just remove the "\r", so the original regex ends up being turned into

^(.*)(?\n\1)+$


which doesn't work.
Flat Previous Topic | Next Topic


Subject Poster Date
   Ignore \r in regex Deipotent 8/24/2011 9:10 am
     Re: Ignore \r in regex Stefan 8/24/2011 12:02 pm
       Re: Ignore \r in regex Deipotent 8/24/2011 5:08 pm
         Re: Ignore \r in regex Stefan 8/25/2011 4:54 am
           Re: Ignore \r in regex Deipotent 8/25/2011 6:20 am
           » Re: Ignore \r in regex Deipotent 8/25/2011 9:46 am
               Re: Ignore \r in regex CrashNBurn 9/22/2011 3:37 pm

Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文