Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: regex capture and quantifiers

by 2teez (Priest)
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


Comment on Re: regex capture and quantifiers
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-07-29 21:05 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 (269 votes), past polls