Optimized replace() and collapseWhitespace() by reusing regexReplace().
Fixed bug in replace() where replacement string was being escaped with preg_quote() and added matching tests.
Merge pull request #21 from Bilge/dry-regex-replace

Optimized replace() and collapseWhitespace() by reusing regexReplace().