escapeRegex function

Escapes any characters that would have special meaning in a reqular expression.