Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 imbibing at the Monastery: (16)
As of 2014-09-18 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (116 votes), past polls