Permalink
Browse files

force regexes in array to match at pos 0 only

  • Loading branch information...
FROGGS committed Feb 23, 2013
1 parent 952d407 commit ff2ceee9decb35ed5327ba14780044d6e2b915ed
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/Cursor.pm
View
@@ -76,7 +76,11 @@ my class Cursor does NQPCursorRole {
}
# A Regex already.
elsif $topic ~~ Regex {
- $match := (nqp::substr($tgt, $pos, $eos - $pos) ~~ $topic).Str;
+ $match := nqp::substr($tgt, $pos, $eos - $pos) ~~ $topic;
+ # In order to return the correct result we need to match from the
+ # current position only.
+ next if $match.from;
+ $match := ~$match;
$len := nqp::chars( $match );
}
# The pattern is a string.

0 comments on commit ff2ceee

Please sign in to comment.