Reduce duplicated regex patterns, implement @escapeRegExp private method...

... for escaping regex.

Use yaml style library declaration.