vessillo / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

Faulty replace using RegExp with capture parens #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A regular expression replace is creating two zeros when only one should
appear.  The result is not consistent -- most of the time two zeros appear,
but occasionally it will insert only one zero as expected.  This seems of
only occur with the number zero; other numbers and characters seem to work OK.

What steps will reproduce the problem?
1. Press shift-F2
2. Select "Regular Expression" for Replace type
3. Enter "mk(\d)" in Find field
4. Enter "mk0$1" in Replace field
5. Select "Match case"
6. Click "Replace"

What is the expected output? What do you see instead?
Original string:  www.site.com/unpack/mk/mk1-conceptual.png
Expected output:  www.site.com/unpack/mk/mk01-conceptual.png
Actual output  :  www.site.com/unpack/mk/mk001-conceptual.png

What version of the product are you using? On what operating system?
FoxReplace 0.12.2; Firefox 3.5.7;  OS X 10.6.2
FoxReplace 0.12.2;  Firefox 3.5.5;  Vista SP2

Please provide any additional information below.
WORKAROUND:  In my particular case, adding the following dash to the Find
and Replace fields ("mk(\d)-" and "mk0$1-" seems to be working for me.

Original issue reported on code.google.com by wilhe...@sacsvt.org on 20 Jan 2010 at 9:56

GoogleCodeExporter commented 9 years ago
I can't reproduce the problem, I always get the expected output. Maybe you are
double-clicking the replace button? It happens to me sometimes with my wireless 
mouse.

Original comment by marc.r...@gmail.com on 22 Jan 2010 at 4:11

GoogleCodeExporter commented 9 years ago
I've found the same problem using just text replace mode (see attached file).  
In both instances, I am in the edit screen shown.  Using Word, I created a 
simple .htm file, and the same find/replace strings work fine.

When the initial string is "K7.6-1", and I replace "K7.6-" with "K-7.6-" it 
also works as expected, generating "K-7.6-1".  Are the multiple text fields 
confusing things?

Original comment by wilhe...@sacsvt.org on 21 Jun 2010 at 9:11

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, now I have reproduced the error. I think that this bug occurs only with 
textareas that have a default text. I will try to fix it. Thanks for the report.

Original comment by marc.r...@gmail.com on 22 Jun 2010 at 5:26

GoogleCodeExporter commented 9 years ago
From my last comment I assume this is the same bug of double replacement in 
textareas with default value, which was fixed in r132, as noted in issue 63.

Original comment by marc.r...@gmail.com on 12 May 2013 at 9:41