! This word takes three string from the stack, finds all occurences ! of "math" in "string" and replaces them with "replace" : replace-string ( string match replace -- string' ) '[ [ _ ?head [ _ % ] [ [ first , ] [ rest ] bi ] if dup empty? not ] loop ] "" make swap drop ; ! For instance "cheesecake" "cake" "pie" replace-string ! Leaves "cheesepie" on the stack