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

Re: Capture Lookahead

by Roy Johnson (Monsignor)
on Jul 26, 2005 at 02:27 UTC ( #478054=note: print w/replies, xml ) Need Help??


in reply to Capture Lookahead

Putting the capturing parens outside the lookahead captures only the characters actually consumed. Putting them inside the lookahead will capture what the lookahead would have consumed (had it not been zero-width). So you'd have to do something like
while ($str =~ /(?=(..{$len}))./g) { print pos, "$1\n"; }
That reads the whole desired capture as a lookahead, then consumes the one char.

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://478054]
help
Chatterbox?
NodeReaper cleans and fillets

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2016-12-05 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (75 votes). Check out past polls.