MCPcopy Create free account
hub / github.com/hoothin/UserScripts / wildcardToRegExpStr

Function wildcardToRegExpStr

Picviewer CE+/dist.user.js:13512–13518  ·  view source on GitHub ↗
(urlstr)

Source from the content-addressed store, hash-verified

13510 }
13511
13512 function wildcardToRegExpStr(urlstr) {
13513 if (urlstr.source) return urlstr.source;
13514 var reg = urlstr.replace(/[()\[\]{}|+.,^$?\\]/g, "\\$&").replace(/\*+/g, function(str){
13515 return str === "*" ? ".*" : "[^/]*";
13516 });
13517 return "^" + reg + "$";
13518 }
13519
13520 function isXPath(xpath) {
13521 return xpath.startsWith('./') || xpath.startsWith('//') || xpath.startsWith('id(');

Callers 1

toREFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected