built-in string replacement + tests + fixed subexp bugs