Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: String regex replacement

by hdb (Prior)
on Feb 24, 2014 at 09:15 UTC ( #1075956=note: print w/ replies, xml ) Need Help??

in reply to String regex replacement

What you describe, sounds like rounding down to the next 1000s. Have a look at this example:

use strict; use warnings; my @numbers = ( 500, 988, 1210, 1300, 2134, 2500 ); # rounding numerically for (@numbers) { my $n = int( $_/1000 )*1000; print "$_ => $n\n"; } # rounding in regex for (@numbers) { s{(\d+)}{int( $1/1000 )*1000}e; print "$_\n"; }

Comment on Re: String regex replacement
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1075956]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2015-07-29 13:45 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (263 votes), past polls