--- gforth/regexp.fs 2008/11/01 22:19:30 1.13 +++ gforth/regexp.fs 2010/05/27 08:58:57 1.14 @@ -281,10 +281,13 @@ Variable >>string >>string $@ >>string off 0 to >>ptr 0 to <>next ( -- addr u ) <>rest ( -- ) >>next >>string $+! ; +: s// ( addr u -- ptr ) \G start search/replace loop - ]] BEGIN [[ ; immediate -: //g ( sys -- ) \ regexp-replace - \G end search/replace loop - ]] WHILE >>next REPEAT end$ [[ - s" " ]] SLiteral << >>string@ rot drop [[ ; immediate + ]] (( // >> [[ ; immediate +: // ( ptr addr u -- addr' u' ) + \G end search/replace single loop + ]] << )) drop >>rest >>string@ [[ ; immediate +: //g ( ptr addr u -- addr' u' ) + \G end search/replace all loop + ]] << LEAVE )) drop >>string@ [[ ; immediate