The string value to converted
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 = createFilenameRegex("*.txt");
lat matches = regex.exec("Hello");
matches; // null
let matches = regex.exec("ug.txt");
matches[0]; // "ug.txt"
matches[1]; // "ug"
let matches = regex.exec(" ug.txt ");
matches[0]; // " ug.txt"
matches[1]; // " ug"
let matches = regex.exec("C:\\temp\\ug.txt");
matches[0]; // "C:\\temp\\ug.txt"
matches[1]; // "C:\\temp\\ug"
let matches = regex.exec("/var/log/ug.txt");
matches[0]; // "/var/log/ug.txt"
matches[1]; // "/var/log/ug"
Create a simple filename style regular expression from the string value, converting any embedded filename wildcard characters
'*'
and'?'
. If the source string contains folder seperators both'/'
and'\'
are treated as synonomous. Each wildcard match will be captured as it's own group. The supported matching values are'*'
Matches any characters zero or more times (including folder seperators ''/
' or'\'
)'?'
Matches any single character once only (including folder seperators'/'
or'\'
)'/'
Matches either'/'
or'\'
character, not captured as a group'\'
Matches either'/'
or'\'
character, not captured as a group