in reply to Re: How do I avoid regex engine bumping along inside an atomic pattern?
in thread How do I avoid regex engine bumping along inside an atomic pattern?
I am not sure if I need set pos($str) to 0 at the beginning. And I am not sure if I need to use \G when parsing.my $c = qr/(?>\s|--[^\n]*(?:\n|\z))/; # one whitespace or one comm +ent # later on, when parsing... pos($str) = 0; if ($str =~ m/a/gc) { print "found a\n" } else { print "missing a\n" } $str =~ m/$c*/gc; # skip any comments, whitespaces if ($str =~ m/x/gc) { print "found x\n" } else { print "missing x\n" }
But again, thanks for your ideas!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How do I avoid regex engine bumping along inside an atomic pattern?
by tilly (Archbishop) on Aug 24, 2008 at 18:54 UTC |