Every line of 'jquery regex match' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
127 export function match(regexp: string, value: string) { 128 const [reg, options] = formatRegex(regexp); 129 const regex = new RegExp(reg, options); 130 const results = regex.exec(value); 131 if (results) return results[0]; 132 return results; 133 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
12 function matchAll(str) { 13 return new RegExp(`^${str}$`); 14 }
1 function match(text, regex) { 2 return text.replace(regex, '').length === 0 3 }
91 return function findMatches(query, callback) { 92 var matches = [], substrRegex, arrayLength = array.length; 93 94 // regex used to determine if a string contains the substring `query` 95 substrRegex = new RegExp(query, 'i'); 96 97 // iterate through the pool of strings and for any string that 98 // contains the substring `query`, add it to the `matches` array 99 for (var i=0; i < arrayLength; i++) { 100 var item = array[i]; 101 if (substrRegex.test(item.name)) { 102 // typeahead expects suggestions to be a js object 103 matches.push({ 104 'itemtype': item.itemtype, 105 'name': item.name, 106 'className': item.class, 107 'is_constructor': !!item.is_constructor, 108 'final': item.final, 109 'idx': i 110 }); 111 } 112 } 113 114 callback(matches); 115 };
1 function matches(value, regex) { 2 if (regex instanceof RegExp) { 3 return regex.test(value); 4 } else if (typeof regex === 'string') { 5 return new RegExp(regex).test(value); 6 } else { 7 return false; 8 } 9 }
53 function match($obj, settings) { 54 var containerId = $obj.attr('id'); 55 initializeSourcePanelEvents(containerId, settings); 56 var sources = jQuery("#" + containerId + " .o_match_dnd_source"); 57 initializeSourceEvents(sources, containerId, settings); 58 var targets = jQuery("#" + containerId + " .o_match_dnd_target"); 59 initializeTargetEvents(targets, containerId, settings); 60 };
119 function match(query) { 120 // TODO: match any location of @ when QuickOpen._handleItemFocus() is modified to 121 // dynamic open files 122 //if (query.indexOf("@") !== -1) { 123 if (query.indexOf("@") === 0) { 124 return true; 125 } 126 }
81 function match(match, capture) { 82 return entities[capture]; 83 }
125 function regex(str) { 126 try { 127 new RegExp(str); 128 return true; 129 } catch(e) { 130 return false; 131 } 132 }
1 export default function getAllMatches (regexp, str) { 2 const results = []; 3 4 let result; 5 while ((result = regexp.exec(str)) !== null) { 6 results.push(result); 7 } 8 9 return results; 10 }