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 effectively the engineer uses the escape-string-regexp package to safely escape regex special characters while preserving Unicode and international characters in a search filter implementation.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses escape-string-regexp",
"description": "The implementation imports and correctly uses the escapeStringRegexp function (or default export) from the escape-string-regexp package to escape the input query string",
"max_score": 30
},
{
"name": "Unicode preservation",
"description": "The implementation correctly preserves Unicode characters (emojis, accented characters, non-Latin scripts) by relying on escape-string-regexp's minimal escaping strategy, which only escapes regex-special characters and leaves Unicode characters unmodified",
"max_score": 25
},
{
"name": "RegExp construction",
"description": "The escaped string from escape-string-regexp is correctly passed to the RegExp constructor (or used in a regex literal) with appropriate flags (global 'g' and case-insensitive 'i')",
"max_score": 25
},
{
"name": "Input validation",
"description": "The implementation validates that the input is a string before processing, throwing an appropriate error for non-string inputs (this may rely on escape-string-regexp's built-in type checking or be implemented separately)",
"max_score": 20
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-escape-string-regexp@5.0.0