Offer Kaye
2009-02-24 14:08:26 UTC
Hi,
I'm not sure whether this is a bug or feature.
I first noticed it when using the regexp "\s*$" in the "Find" section
of the "Find and Replace" dialog, and doing a (regexp) replace for
some character, for example ";", I see ";" inserted twice if there are
one or more space characters at the end of the line, instead of just
once (as is the case if there are no spaces).
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
";".
Trying "perl -ne's/a*$/;/;print;' file" with "file" having the above
content gave as expected a single ";" at the end of each line.
However with NEdit S&R, I saw the same behavior as "\s*", namely 2 ";"
if "a" appeared one or more times in the line.
Note BTW that regexp with start-of-line anchor ("^a*" for example) did
not have any such problems.
Best regards,
I'm not sure whether this is a bug or feature.
I first noticed it when using the regexp "\s*$" in the "Find" section
of the "Find and Replace" dialog, and doing a (regexp) replace for
some character, for example ";", I see ";" inserted twice if there are
one or more space characters at the end of the line, instead of just
once (as is the case if there are no spaces).
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
";".
Trying "perl -ne's/a*$/;/;print;' file" with "file" having the above
content gave as expected a single ";" at the end of each line.
However with NEdit S&R, I saw the same behavior as "\s*", namely 2 ";"
if "a" appeared one or more times in the line.
Note BTW that regexp with start-of-line anchor ("^a*" for example) did
not have any such problems.
Best regards,
--
Offer Kaye
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Offer Kaye
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss