 
 <PRIVATE
 
-:: (next-match) ( i string regexp word: ( i string -- j ) reverse? -- i start end ? )
+:: (next-match) ( i string regexp word: ( i string regexp -- j ) reverse? -- i start end ? )
     i string regexp word execute dup [| j |
         j i j
         reverse? [ swap [ 1+ ] bi@ ] when

    ] [ drop f f f f ] if ; inline

: search-range ( i string reverse? -- seq )
    [ drop 0 [a,b] ] [ length [a,b) ] if ; inline

:: next-match ( i string regexp word reverse? -- i start end ? )
    f f f f

    dup '[
        dup \ next-initial-word = [
            drop _ [ compile-regexp dfa>> ] [ reverse-regexp? ] bi
            '[ { array-capacity string regexp } declare _ _ next-match ]
            (( i string regexp -- i start end string )) simple-define-temp
        ] when
    ] change-next-match ;
