Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regexp multiple match

by thinker (Parson)
on Apr 29, 2005 at 08:24 UTC ( [id://452548]=note: print w/replies, xml ) Need Help??


in reply to Regexp multiple match

Hi jeteve,

What you want is the /g modifier, as this, highly contrived, example will show

#!/usr/bin/perl use strict; use warnings FATAL => "all"; my $s = "batcatbetnetbitfit"; my $p = "b.t"; my @matches = $s =~ /$p/g; print "@matches\n"; __END__ returns bat bet bit

cheers

thinker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-09-07 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.