Re: "[char]*$" S&R regexp doing double-pass?

Joerg Fischer <[email protected]>
Newsgroups gmane.editors.nedit.user
Message-ID <[email protected]>
> So if for example I started with:
> 1
> 2<space>
> 3<space><space>
> 4<space><space><space>
> 
> And did the above search/replace, I end up with:
> 1;
> 2;;
> 3;;
> 4;;
> 
> To debug, I tried starting with:
> 0
> 1a
> 2aa
> 3aaa
> 4aaaa
> 
> And doing S&R for "a*$" to ";". The way I read this is "replace zero
> or more instances of the character "a" at the end of the line with
> ";".
> ...
> Note BTW that regexp with start-of-line anchor ("^a*" for example) did
> not have any such problems.

What you describe happens by matching in _backward_ direction. Try to search
in forward direction and it behaves correctly. Or you need a non-greedy
start of the pattern, like you noticed.

This is caused by the type of the regex engine implemented into NEdit.
Has to do something with efficiency.

--Jörg
-- 
NEdit Discuss mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.