Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: regex capture and quantifiers

by 2teez (Vicar)
on Apr 30, 2013 at 21:11 UTC ( #1031476=note: print w/replies, xml ) Need Help??

in reply to regex capture and quantifiers

Something like this:

use warnings; use strict; my $str = '12/22/2005 20 Notice of Agenda of Matters Scheduled for Hea +ring (related document(s)2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, + 16, [17], 18, 19) Filed by Fubar, Inc.. Hearing scheduled for 4/11/2013 at 11:30 AM'; if($str=~m{related.+\)(.+?)\[(.+?)\](.+?)\)}){ print join "\n" => map{ split/,\s*/,$_}($1,$2,$3); }
Update: I think it is also a good practice to test what you match.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031476]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-06-18 08:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.