Click to See Complete Forum and Search --> : Regular Expression for decimals


ocelot
04-23-2009, 05:54 AM
Hi all,

Im trying to write a regular expression whereby a decimal is converted into
"percentage format". The three scenarios that can happen and that I
want changed are for example:

0.01 changed to 1
0.10 changed to 10
0.134 changed to 13.4

Ive started but am a bit stuck now:

expression="\A(.*)\.(.*)\Z"
expression="\A(\d{2})(:?.*)\Z"


Any help please?

thanks!
ocelot

jkmyoung
04-29-2009, 12:58 PM
? Why not just multiply by 100?