Super regexp to format numbers

[email protected] (Alexandre Jousset) Mon, 28 Aug 2006 18:13:34 +0200
Newsgroups perl.fwp
Organization GTMP
Message-ID <[email protected]>
	Hello list,

	I have a problem that I've solved with some logic and a few lines of 
code but I'm sure that there is a good regexp that can do the job. So I 
ask the regexp gurus of this list whether they have a solution.

	Let's start with this :

----------------------------------------------------
$number = 12345678.1234
$number =~ s/./,/; # change decimal point to French notation
spacify($number); # Do the magic
print "$number\n";
----------------------------------------------------

	and this should print :

12 345 678,1234

	For the moment I have a (too) complicated sub spacify and I would like 
to simplify it to a regexp. Is this possible ? How ? Of course we can 
use this to output the number in English notation like 
'12,345,678.1234', same thing...

	Any clue ? I'm sure this is an old problem...

	Regards,
-- 
--      \^/                                            --
--    -/ O \---------------------------------------    --
--   | |/ \|      Alexandre (Midnite) Jousset      |   --
--    -|___|---------------------------------------    --