Toad World® Forums

RegEx replace of $ adds extra lines

Howdy!

In 12.10.0.25, I need to add commas to the end of several (hundreds) lines. The easiest way to do this is to do a RegEx replace of “$” with “,”. But if I try that on this, selecting the “aa”, “bb”, and “cc” rows only and have the Scope on the replace set to “Selected text”:

select
aa
bb
cc
dd
from dual;

…it ends up:

select
aa,
,
bb,
,
cc,
,
dd
from dual;

There’s an extra line added after each match in the replace, then replaced.

Thanks!
Rich

I see and I’ll log. In the meantime search for “\r\n” and replace with “,$0” and that will cover all, but the last line which you’ll need to address manually.

This also works and will handle the last line, but will not add comma to blank lines which may be desirable anyway.

Search for: .$

Replace With: $0,

Thanks, Michael!

Rich

This came up recently using another example. After some testing it’s been identified as a bug in Delphi. It has been logged with Embarcadero.