MCPcopy
hub / github.com/pandao/editor.md / toRegex

Function toRegex

lib/codemirror/addon/mode/simple.js:66–76  ·  view source on GitHub ↗
(val, caret)

Source from the content-addressed store, hash-verified

64 }
65
66 function toRegex(val, caret) {
67 if (!val) return /(?:)/;
68 var flags = "";
69 if (val instanceof RegExp) {
70 if (val.ignoreCase) flags = "i";
71 val = val.source;
72 } else {
73 val = String(val);
74 }
75 return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags);
76 }
77
78 function asToken(val) {
79 if (!val) return null;

Callers 2

RuleFunction · 0.85
enterLocalModeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…