Re: zero width lookahead match On 5/30/07, Sharan Basappa  wrote:
> Hi All,
>
> I have some background working with scanners built from Flex. And I have
> used lookahead capability of flex many a times. But I dont understand the
> meaning of ZERO in zero lookahead match rule i.e. (?=pattern)
snip

I don't know jack about flex, so I can't help you with a comparison, but

snip
> The other question I have is - how does regex engine decide that it has to
> move further its scanner by 1 character everytime
snip

this is what the zero-width lookahead assertion means.  It say with
out moving where you are currently starting the match, make certain
you can match the following pattern.  If you want it to move where the
match starts then you have to include something that does not have
zero-width like this

#match groups of three characters followed by three characters: "123" and "456"
@store = $str =~ m/(\\d\\d\\d)(?=\\d\\d\\d)/g;

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


