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 pattern validator utility that checks if strings match specific patterns with character range requirements.
Your task is to implement a pattern matching system that can validate strings against patterns containing character ranges. The system should support:
The validator should handle patterns that specify exactly which characters are acceptable at specific positions in a string.
Implement a validatePattern(pattern, testString) function that:
true if the test string matches the pattern, false otherwise"file[0-9].txt" matches "file3.txt" but not "file10.txt" or "fileA.txt" @test"test[a-z].js" matches "testx.js" but not "testX.js" or "test12.js" @test"data[A-Z].csv" matches "dataM.csv" but not "datam.csv" or "data5.csv" @test"page[0-5].html" matches "page2.html" and "page5.html" but not "page7.html" @test"log[abc].txt" matches "loga.txt" and "logc.txt" but not "logd.txt" @test@generates
/**
* Validates if a string matches a pattern with character range specifications.
*
* @param {string} pattern - The pattern to match against, containing character ranges
* @param {string} testString - The string to validate
* @returns {boolean} - true if testString matches pattern, false otherwise
*/
function validatePattern(pattern, testString) {
// Implementation here
}
module.exports = { validatePattern };Provides pattern to regular expression conversion capabilities.
@satisfied-by