Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to capture all occurances from a slurped file.

by shmem (Chancellor)
on Aug 24, 2006 at 22:04 UTC ( [id://569465]=note: print w/replies, xml ) Need Help??


in reply to How to capture all occurances from a slurped file.

You're just missing the loop:
while ($data =~ m{(\d+-)(\d+-)(\d+)(\s*/\s*)(\d+)(\s*/\s*)(\d+)}g) { print "$1, $2, $3, $4, $5, $6, $7\n"; }

After each match is found, the search continues where the last match left. So you get all occurrences.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: How to capture all occurances from a slurped file.
by Grey Fox (Chaplain) on Aug 24, 2006 at 23:21 UTC
    Thanks;
    I knew I was close. I just could not put my finger on what to use for the loop.
    -- Grey Fox
    Perl - Hours to learn lifetime to master.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-25 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found