Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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.


Comment on Re: Capture Lookahead
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-07-12 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls