Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: position after global matches?

by duff (Parson)
on May 29, 2007 at 18:56 UTC ( #618031=note: print w/replies, xml ) Need Help??


in reply to position after global matches?

Since I didn't see anyone mention this (now watch someone submits a node that does while I'm busy typing), if you don't really need a regular expression, you might be better off just using index

#!/usr/bin/perl $_ = 'TATATATATATA'; $str = "TATA"; $p = -1; while (1) { $p = index($_,$str,$p+1); last if $p < 0; print "Found $str at position $p\n"; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2021-10-23 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (86 votes). Check out past polls.

    Notices?