Find and replace with regular expressions

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
BDifferent
Posts: 2
Joined: Thu Oct 16, 2003 9:58 am

Find and replace with regular expressions

Post by BDifferent »

Hi,

I have a data file which contains floating point values with a comma as decimal separator (as it is usual in Germany). I want to replace these commas by the decimal point, but only in the floating point values; commas also appear elsewhere in the file, e.g. separating text. So I did a search with regular expressions; I searched for "[0-9],[0-9]" which works well. But if I want to replace these characters by "[0-9].[0-9]" the regular expressions are also inserted. Just entering the "." as replacement text does not work either (as expected). How can I achieve my goal of replacing only commas surrounded by numbers by a decimal point?

Thanks in advance,
Finn
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Find ([0-9]),([0-9])
Replace \1.\2
Using Posix
Then I open up and see
the person fumbling here is me
a different way to be
BDifferent
Posts: 2
Joined: Thu Oct 16, 2003 9:58 am

Re: Find and replace with regular expression

Post by BDifferent »

s_reynisson wrote:Find ([0-9]),([0-9])
Replace \1.\2
Using Posix
That one works, thank you! However, a different solution has just come up: I could just change the system's country settings and create the data file again which then has the "." as decimal separator...

Thanks for your efforts,
Finn
Post Reply