Escape pattern before compiling REGEX