Convert German number format to English / US format

General discussions about Advanced Find and Replace
Post Reply
maudie

Convert German number format to English / US format

Post by maudie »

Hi,

i have tried out a few solutions to convert the decimal notation of a German monetary figure into GB/US decimal notation, such as:

convert: 1.234.567,00

into: 1,234,567.00 OR 1 234 567.00

i really have no idea about wildcards or regular expressions or whether they can be used only in the Batch Replace function. I'm afraid the helpfile description of RE is also too confusing for my poor brain :oops: , otherwise i guess i wouldn't be asking you all here for an answer!

thanks to anyone who can help!

maudie

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Re: Convert German number format to English / US format

Post by Abacre »

Hi,

maudie wrote:convert: 1.234.567,00

into: 1,234,567.00


Here is a quick solution that will work. You should add 3 pairs into
batch replace grid:

Search for:
(\d)\.(\d)
Replace with:
$1a$2

Search for:
(\d),(\d)
Replace with:
$1.$2

Search for:
(\d)a(\d)
Replace with:
$1,$2

Sure after some reasoning it's possible to make one complex RE. But
this solution with 3 RE pairs is quick and it works.

maudie wrote:convert: 1.234.567,00

into: 1 234 567.00


Search for:
(\d)\.(\d)
Replace with:
$1a$2

Search for:
(\d),(\d)
Replace with:
$1.$2

Search for:
(\d)a(\d)
Replace with:
$1 $2
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

maudie

Convert German number format to English / US format

Post by maudie »

wow, thanks Roman!

you've done it again. works like a dream! i could bounce around the house in joy!

i have nothing against doing it in "3 passes" like that... it let me change 4400 entries in an html file in a minute!

also, now i understand batch replacing much much better.

oh, and thanks for answering so quickly !

maudie

Post Reply