MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / buildRegexp

Function buildRegexp

lib/web/CodeMirror/mode/powershell/powershell.js:16–31  ·  view source on GitHub ↗
(patterns, options)

Source from the content-addressed store, hash-verified

14
15CodeMirror.defineMode('powershell', function() {
16 function buildRegexp(patterns, options) {
17 options = options || {};
18 var prefix = options.prefix !== undefined ? options.prefix : '^';
19 var suffix = options.suffix !== undefined ? options.suffix : '\\b';
20
21 for (var i = 0; i < patterns.length; i++) {
22 if (patterns[i] instanceof RegExp) {
23 patterns[i] = patterns[i].source;
24 }
25 else {
26 patterns[i] = patterns[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
27 }
28 }
29
30 return new RegExp(prefix + '(' + patterns.join('|') + ')' + suffix, 'i');
31 }
32
33 var notCharacterOrDash = '(?=[^A-Za-z\\d\\-_]|$)';
34 var varNames = /[\w\-:]/

Callers 1

powershell.jsFile · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected