virudinesh has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; my @f =( "Figure. 89-9","Figure 12-8","Figure 1.2"); foreach(@f) { if($_=~m/fig(. |[a-z])*(\d+)(\-(\d+))?/i) { print " $2-$4 \n"; } }
its output comes like
89-9 12-8 1-
but am need output like this one 89-9 12-8 1.2
how to print both one's - (or). how to handle both in single regular expression
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to do get digit numbers like -,.?
by hdb (Monsignor) on Jun 01, 2013 at 06:49 UTC | |
by frozenwithjoy (Priest) on Jun 01, 2013 at 13:24 UTC | |
|
Re: how to do get digit numbers like -,.?
by Laurent_R (Canon) on Jun 01, 2013 at 09:51 UTC | |
|
Re: how to do get digit numbers like -,.?
by Anonymous Monk on Jun 01, 2013 at 06:39 UTC |