Next | Regular Expression Mastery | 80 |
Since 5.6, Perl has had a very clever floating-anchored search
It tries to locate two long strings which must be in the target
It searches for these first, then works inward
For example, in
"----B----A---" =~ /A-*B/
Perl looks first for A, then for B
It figures out that there's only one A
There's no consistent choice for B, so it fails immediately
No backtracking search
"----A----B---" =~ /A-*B/
Here Perl locates the A immediately, and skips the preceding characters
For fullest details, see perldebguts and perl -Mre=debug output
/i disables this --- avoid it
Next | Copyright © 2002 M. J. Dominus |