develooper Front page | perl.beginners | Postings from May 2007

zero width lookahead match

Thread Next
Sharan Basappa
May 30, 2007 04:58
zero width lookahead match
Message ID:
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)

For example, to capture overlapping 3 digit patterns from string $str =
I use the regex @store = $str =~ m/(?=(\d\d\d))/g;
So here the regex engine actually looks ahead by chars digits.

The other question I have is - how does regex engine decide that it has to
move further its scanner by 1 character everytime since I get output 123 234
345 456
when I run this script ?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About