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%
Build a utility that converts file path patterns with special characters into regular expressions that can be used for matching.
Users need to filter file paths in a large codebase based on patterns that contain various special characters (dots, dollar signs, parentheses, etc.). These characters should be matched literally, not interpreted as regex metacharacters.
Implement a module that converts file path patterns into regular expressions with the following behavior:
*) into regular expressions"*.min.js" matches path "app.min.js" exactly @test"src/$.js" matches path "src/$.js" exactly @test"lib/util(v2).js" matches path "lib/util(v2).js" exactly @test"data/*.csv" matches path "data/report.csv" exactly @test@generates
/**
* Converts a file path pattern to a regular expression
* @param {string} pattern - The file path pattern to convert
* @returns {RegExp} A regular expression that matches the pattern
*/
function patternToRegex(pattern) {
// Implementation here
}
module.exports = { patternToRegex };Converts glob patterns to regular expressions with proper escaping of special characters.