tessl install tessl/npm-glob-to-regexp@0.4.0Convert globs to regular expressions
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.15x
Baseline
Agent success rate without this tile
87%
A utility for validating file names against specific patterns using simple wildcard matching.
"log-?.txt", the filename "log-a.txt" is valid @test"log-?.txt", the filename "log-1.txt" is valid @test"log-?.txt", the filename "log-ab.txt" is invalid @test"log-?.txt", the filename "log-.txt" is invalid @test"data-??-??.csv", the filename "data-01-23.csv" is valid @test"data-??-??.csv", the filename "data-ab-cd.csv" is valid @test"data-??-??.csv", the filename "data-1-23.csv" is invalid @test"?.log", the filename "a.log" is valid @test"test?.txt", the filename "test5.txt" is valid @test"file-?-?.dat", the filename "file-x-y.dat" is valid @test@generates
/**
* Validates a filename against a pattern with single-character wildcards.
* The pattern uses '?' to match exactly one character.
*
* @param {string} filename - The filename to validate.
* @param {string} pattern - The pattern to match against, using '?' for single-character wildcards.
* @returns {boolean} True if the filename matches the pattern, false otherwise.
*/
function validateFilename(filename, pattern) {
// IMPLEMENTATION HERE
}
module.exports = { validateFilename };Converts glob patterns to regular expressions for pattern matching.
@satisfied-by