javascript Programming Glossary: escaperegexp
Replacing all occurrences of a string in javascript? http://stackoverflow.com/questions/1144783/replacing-all-occurrences-of-a-string-in-javascript . I've reproduced a portion of that answer here function escapeRegExp str return str.replace . ^ g So in order to make the replaceAll.. it could be modified to the following if you also include escapeRegExp function replaceAll find replace str return str.replace new..
Escape string for use in Javascript regex [duplicate] http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex share improve this question Short 'n Sweet function escapeRegExp str return str.replace . ^ g See MDN Javascript Guide Regular.. . ^ g See MDN Javascript Guide Regular Expressions escapeRegExp All of these should be escaped ^ . All of these should be escaped.. are not required to be. . . . . Test Case A typical url escapeRegExp path to resource.html search query path to resource .html search..
|