in reply to When greedy constructs do battle, can I choose the winner?
It sounds like you just want to make {1,5} not greedy to me.
Is this what you want?$running_total =~ s/(\d{1,5}?)0*$/$1/;
update: Looking at your question again, perhaps your problem is also that you're doing a substitution (which I just parroted) and you really want to do something more like this:
$running_total = $1 if $running_total =~ /(\d{1,5}?)0*$/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: When greedy constructs do battle, can I choose the winner?
by amarquis (Curate) on Sep 20, 2007 at 18:35 UTC | |
by duff (Parson) on Sep 20, 2007 at 18:45 UTC |