Escape RegExp special characters in strings for safe use in regular expressions
Overall
score
100%
Evaluation — 100%
↑ 1.00xAgent success when using this tile
{
"context": "This criteria evaluates how well the engineer uses the escape-string-regexp package to safely handle special RegExp characters when implementing a text search utility. The focus is on proper usage of the escapeStringRegexp function to prevent regex injection and enable literal text matching.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Package Import",
"description": "Correctly imports the escapeStringRegexp function from the escape-string-regexp package using proper ES module or CommonJS syntax",
"max_score": 10
},
{
"name": "Escape Search Term",
"description": "Uses escapeStringRegexp to escape the search term before constructing a RegExp in the searchText function",
"max_score": 30
},
{
"name": "RegExp Construction",
"description": "Constructs a RegExp using the escaped string returned by escapeStringRegexp with appropriate flags for case sensitivity",
"max_score": 25
},
{
"name": "Global Matching",
"description": "Uses escapeStringRegexp with RegExp global flag ('g') in the findAllMatches function to find all occurrences",
"max_score": 20
},
{
"name": "Case Insensitivity",
"description": "Applies escapeStringRegexp before creating RegExp with case-insensitive flag ('i') when caseSensitive option is false",
"max_score": 15
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-escape-string-regexp@5.0.0