• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Numeric Regular Expression

 
Ranch Hand
Posts: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Trying to get this regular expression working.



I'm trying to have a regular expression that takes a number to determine how many decimals it wants in $1 and the rest should go into $2. Basically I have a number like 35.69. I find the position of the decimal and then any 4 digit number a user enters has to be reformated to look like the number specified (in this case 35.69). What I'm trying to do is take the index of the decimal in 35.69 and then use it within the previously mentioned code to grab first N number of digits and put the rest into $2. Each time I run this I keep getting only the second digit in $1 (in this case 5.69, if Answer was 95.67 Answer would end up being 5.67, etc..,). Any help would be appreciated. Thanks in advance.

Rob
 
Rob Hunter
Ranch Hand
Posts: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry guys. Bracket wasn't on the other side of the braces.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic