MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / escapeRegExp

Function escapeRegExp

libs/htmlwidgets-1.5.3/htmlwidgets.js:131–133  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

129
130 // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
131 function escapeRegExp(str) {
132 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
133 }
134
135 function hasClass(el, className) {
136 var re = new RegExp("\\b" + escapeRegExp(className) + "\\b");

Callers 1

hasClassFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected