in reply to ZERO_LENGTH match
$_ = 'aaabbb'; while (/((?: a | c? )*)/xg) { printf "1: '%s' '%d'\n", $&, pos; } while (/(( a )* | ( c? )?)/xg) { printf "2: '%s' '%d'\n", $&, pos; } __END__ 1: 'aaa' '3' 1: '' '3' 1: '' '4' 1: '' '5' 1: '' '6' 2: 'aaa' '3' 2: '' '3' 2: '' '4' 2: '' '5' 2: '' '6'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ZERO_LENGTH match
by sh1tn (Priest) on Aug 01, 2005 at 15:52 UTC |