diff --git a/basis/regexp/regexp.factor b/basis/regexp/regexp.factor index c9a1d2f47d..4014c4507c 100644 --- a/basis/regexp/regexp.factor +++ b/basis/regexp/regexp.factor @@ -33,9 +33,9 @@ IN: regexp : matches? ( string regexp -- ? ) dupd match - [ [ length ] [ length>> 1- ] bi* = ] [ drop f ] if* ; + [ [ length ] bi@ = ] [ drop f ] if* ; -: match-head ( string regexp -- end/f ) match [ length>> 1- ] [ f ] if* ; +: match-head ( string regexp -- end/f ) match [ length ] [ f ] if* ; : match-at ( string m regexp -- n/f finished? ) [ diff --git a/basis/regexp/traversal/traversal.factor b/basis/regexp/traversal/traversal.factor index c9e8a54348..6bc44c7a99 100644 --- a/basis/regexp/traversal/traversal.factor +++ b/basis/regexp/traversal/traversal.factor @@ -144,7 +144,10 @@ M: capture-group-off flag-action ( dfa-traverser flag -- ) [ increment-state do-match ] when* ] unless ; -: return-match ( dfa-traverser -- interval/f ) +: return-match ( dfa-traverser -- slice/f ) dup matches>> [ drop f ] - [ [ start-index>> ] [ peek ] bi* 1 <range> ] if-empty ; + [ + [ [ text>> ] [ start-index>> ] bi ] + [ peek ] bi* rot <slice> + ] if-empty ;