Use substring instead of RegExp.

For performance.