mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-28 05:26:10 +02:00
Add Ability to Import All File Areas at Once #271
* Simple wildcard support for area tags param
This commit is contained in:
parent
d6dce82a92
commit
14f7ca9dcc
4 changed files with 41 additions and 3 deletions
|
@ -29,6 +29,7 @@ exports.isAnsi = isAnsi;
|
|||
exports.isAnsiLine = isAnsiLine;
|
||||
exports.isFormattedLine = isFormattedLine;
|
||||
exports.splitTextAtTerms = splitTextAtTerms;
|
||||
exports.wildcardMatch = wildcardMatch;
|
||||
|
||||
// :TODO: create Unicode version of this
|
||||
const VOWELS = [
|
||||
|
@ -474,3 +475,8 @@ function isAnsi(input) {
|
|||
function splitTextAtTerms(s) {
|
||||
return s.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
|
||||
}
|
||||
|
||||
function wildcardMatch(input, rule) {
|
||||
const escapeRegex = (s) => s.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
||||
return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(input);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue