7 * Escape string for safe inclusion in regular expression
9 * The following characters are escaped:
11 * \ { } ( ) | . ? * + - ^ $ [ ]
15 * @param {string} str String to escape
16 * @return {string} Escaped string
18 escape: function ( str ) {
19 return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' );