Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: multiple matches with regexp

by thelenm (Vicar)
on Oct 10, 2003 at 21:20 UTC ( [id://298423]=note: print w/replies, xml ) Need Help??


in reply to multiple matches with regexp

You can do this by doing a global match and resetting pos on each iteration to the position after the match, like this:

$_ = "aaaaa"; while (/aa/g) { print "Match at $-[0]\n"; pos = $-[0] + 1; }

-- Mike

--
XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
-- grantm, perldoc XML::Simpler

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2024-03-28 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found