dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Regular Expression for decimals

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    Regular Expression for decimals

    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

  2. #2
    Join Date
    May 2007
    Posts
    288
    ? Why not just multiply by 100?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles