Fix replace method

Now replaces each substring of the source parameter that matches this regular expression with the given replacement parameter.