     ] [ drop f f f f ] if ; inline
 
 : search-range ( i string reverse? -- seq )
-    [ drop 0 [a,b] ] [ length [a,b) ] if ; inline
+    [ drop dup 1+ -1 ] [ length 1 ] if range boa ; inline
 
 :: next-match ( i string regexp word reverse? -- i start end ? )
     f f f f


<PRIVATE

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

! Copyright (C) 2008, 2009 Doug Coleman, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators kernel kernel.private math sequences
sequences.private strings sets assocs prettyprint.backend
prettyprint.custom make lexer namespaces parser arrays fry locals
regexp.parser splitting sorting regexp.ast regexp.negation
regexp.compiler words call call.private math.ranges ;
IN: regexp

TUPLE: regexp
