Regular expression replacement and some utility methods

- improved documentation