in reply to Applying a regex to part of a string
It matches (in the test case) between 11 and 30 characters at the beginning of the string, and then tries matching the pattern. If, after it matches the pattern, $+[0] is still less than $END, then it succeeds; otherwise, it backtracks.my ($START, $END) = (11, 30); if ($string =~ /^\C{$START,$END}?($pattern)(?(?{ $+[0] < $END })|(?!)) +/) { # it's ok }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Applying a regex to part of a string
by holdyourhorses (Monk) on Aug 19, 2005 at 07:27 UTC |