Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern matching for floating numbers

Status
Not open for further replies.

hbkid

Programmer
Mar 7, 2005
3
US
How do I find numbers in a line and multiply it by 1000, the numbers could be floating
eg:
create_clock -name "CLKBLK" -period 64.000 -waveform {0 32}

I want to change this to
create_clock -name "CLKBLK" -period 64000 -waveform {0 32000}

Is there in perl to do a pattern match for a number. I know how to do it to find a digit (\d+) but it's not the same for a possible floating point no.
 
Code:
use Regexp::Common;
s/$RE{num}{real}/$& * 1000/ge;

________________________________________
Andrew

I work for a gift card company!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top