Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Elegant (i.e. declarative) way to find all possibly overlapping matches

by Zaxo (Archbishop)
on Sep 18, 2003 at 18:17 UTC ( [id://292478]=note: print w/replies, xml ) Need Help??


in reply to Elegant (i.e. declarative) way to find all possibly overlapping matches

As long as you're looking for literal strings instead of regex matches,

my $spot = 0; while (($spot = index $s, 'aa', $spot) != -1) { printf "found aa at %d\n", $spot++; }
The increment in the loop is important.

After Compline,
Zaxo

  • Comment on Re: Elegant (i.e. declarative) way to find all possibly overlapping matches
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-18 12:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found