Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Regexes: finding ALL matches (including overlap)

by blokhead (Monsignor)
on Jun 04, 2005 at 12:21 UTC ( [id://463519]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub match_all_ways {
        my ($string, $regex) = @_;
    ...
    
    print match_all_ways("abcdef", qr/..*..*./); # 20
    print match_all_ways("abcdef", qr/..*..*./); # undef
    
  2. or download this
    sub match_all_ways {
        use vars '$count';
    ...
        $string =~ /(?:$regex)$incr(?!)/;
        return $count;
    }
    
  3. or download this
    {
      my $count;
    ...
          return $count;
      }
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-25 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found