The value to be converted into a RegExp, if the value is not a string it will coerced to a string.
Optional
ignoreCase: booleanFlag to indicate whether the regular expression should be case-sensitive, Defaults to false.
Optional
fullMatch: booleanFlag to identify whether the RegExp should be wrapped with '^'
and '$'
to
incidate match the entire string only.
The new Regular Expression created from the provided value.
let regex = createWildcardRegex("Hello*");
let matches = regex.exec("Hello");
matches[0]; // "Hello";
matches[1]; // ""
let matches = regex.exec("Hello Darkness");
matches[0]; // "Hello Darkness"
matches[1]; // " Darkness"
let matches = regex.exec("Darkness Hello");
matches[0]; // "Hello"
matches[1]; // ""
let regex.exec("Darkness Hello.");
matches[0]; // "Hello."
matches[1]; // "."
Create a simple wildcard regular expression from the string value, converting any embedded wildcard
'*'
characters to match any character zero or more times (including folder seperators'/'
or'\'
), while escaping all other characters. The supported matching values are'*'
Matches any characters zero or more times (including folder seperators ''/
' or'\'
)