-:: update-match-group ( str match regexp n -- str' )
- n H{ } [ 1 + CHAR: $ swap "" 2sequence ] cache :> x
- x str subseq? [
- x match "" like regexp n nth-match str replace
- ] [ str ] if ;
+: update-match-group ( str match regexp n -- str' )
+ [ nth-match ] [ CHAR: 1 + "$%c" sprintf ] bi swap replace ;