Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: how to do get digit numbers like -,.?

by hdb (Prior)
on Jun 01, 2013 at 06:49 UTC ( #1036387=note: print w/ replies, xml ) Need Help??


in reply to how to do get digit numbers like -,.?

++ for asking a complete question. Here is a complete answer:

use warnings; use strict; my @f =( "Figure. 89-9","Figure 12-8","Figure 1.2"); foreach (@f) { print " $1\n" if /(\d+[-.,]\d+)/; }


Comment on Re: how to do get digit numbers like -,.?
Download Code
Replies are listed 'Best First'.
Re^2: how to do get digit numbers like -,.?
by frozenwithjoy (Curate) on Jun 01, 2013 at 13:24 UTC
    Just expanding upon your good answer to include the abbreviation 'Fig':
    perl -E 'my @f =("2013-06-01", "fig 1-1", "Fig. 2.2", "Figure. 89-9"," +Figure 12-8","Figure 1.2"); foreach (@f) { print " $1\n" if /fig(?:ure)?\.?\s(\d+[-.,]\d+)/i; }' 1-1 2.2 89-9 12-8 1.2

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2015-07-31 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (279 votes), past polls