CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-escape-string-regexp

Escape RegExp special characters in strings for safe use in regular expressions

Overall
score

100%

Evaluation100%

1.00x

Agent success when using this tile

Overview
Eval results
Files

rubric.jsonevals/scenario-3/

{
  "context": "This criteria evaluates how effectively an engineer uses the escape-string-regexp package to safely escape special regex characters for cross-platform and Unicode-compatible regex patterns. The evaluation focuses on proper usage of the package's escaping functionality to handle special characters, hyphens, and Unicode patterns correctly.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Import escape-string-regexp",
      "description": "Correctly imports the escapeStringRegexp function from the escape-string-regexp package using the default import syntax",
      "max_score": 10
    },
    {
      "name": "Escape search term",
      "description": "Uses escapeStringRegexp to escape the search term before constructing the regular expression, ensuring special regex characters are treated as literal text",
      "max_score": 30
    },
    {
      "name": "Construct regex pattern",
      "description": "Correctly constructs a RegExp using the escaped string from escapeStringRegexp as the pattern, ensuring the escaped output is used properly",
      "max_score": 20
    },
    {
      "name": "Unicode flag support",
      "description": "When the unicode option is true, constructs the RegExp with the 'u' flag, demonstrating understanding that escape-string-regexp's output (especially \\x2d for hyphens) works correctly with Unicode patterns",
      "max_score": 15
    },
    {
      "name": "Case-insensitive flag",
      "description": "When the caseInsensitive option is true, constructs the RegExp with the 'i' flag, using it in combination with the escaped pattern",
      "max_score": 10
    },
    {
      "name": "Global flag usage",
      "description": "Uses the 'g' flag when constructing the RegExp to find all occurrences of the pattern in the target text, not just the first match",
      "max_score": 10
    },
    {
      "name": "Extract matches correctly",
      "description": "Uses appropriate string/regex methods (like match() or matchAll()) to extract all occurrences of the escaped pattern from the target text and returns them as an array",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-escape-string-regexp@5.0.0

tile.json