Toad World® Forums

"Replace All" by regular expression not working with non-ascii characters

Use this code

CREATE PACKAGE toad_test AS
PROCEDURE test1; – :radioactive:x
PROCEDURE test2; – :radioactive:x
END;

and replace all " – .+$" by “” with the option “Regular expressions” enabled.

The unexpected result is

CREATE PACKAGE toad_test AS
PROCEDURE test1;
PROCEDURE test☢x
END;

It works fine when using single replace.

This looks like a 64-bit issue only that isn’t in 12.9. I’m not sure about 12.10. The reason eludes me at the moment. The offset for the second match is shifted down by 2. Isolating the regex search into its own application doesn’t reproduce the problem. I’ve logged it.

Any progress with this?

Today I copied a query from a website that had several wrong quotes like this:
SELECT dummy AS “dummy2” FROM dual;

Tried to fix it using Replace with Regular expression [“”] => " but the result was
SELECT dummy AS "dumm"2” FROM dual;

The original issue above has additional cases that have been reported to replicate the same underlying Delphi bug. The bug is still listed as "Open" with priority "Major" in Embarcadero's bug tracking system (free? account needed to view the issue). I've just added another comment to it in case they are monitoring.

Your smart quotes to double quote example works for me in current beta. I copied your sample query and search string and pasted into Toad and this is what I see. What am I missing?

Not sure what is different, are you using 64 bit too?

I tried to reproduce it with "From cursor" and managed to get another wrong result after undoing a previous replace:

|SELECT dummy AS “dummy2” FROM dual;
[Replace All]
SELECT dummy AS "dumm"y2” FROM dual;
This is wrong.

[Undo]

SELECT dummy AS “|dummy2” FROM dual;
[Replace All]
SELECT dummy AS “dummy2" FROM dual;
This is correct.

[Undo]

|SELECT dummy AS “dummy2" FROM dual;
[Replace All]
SELECT dummy A" “du"my2” FROM dual;
This is wrong again, but different than the first one.

Ah, no. I forgot about that. I see it in 64-bit.