Regex code review phrases

  • "Not anchored" — add ^ and $ to match the full string, not just a substring
  • /i flag — case-insensitive; /g flag — global (all matches, needed for replace-all)
  • Catastrophic backtracking / ReDoS — nested quantifiers on overlapping classes can cause exponential time
  • "Use the URL constructor / JSON.parse / DOM parser" — regex can't reliably parse nested structures
  • Break down complex regex left-to-right; explain each component in the review comment

Question 0 of 5

A code review has the comment: "This regex is not anchored — it will match the pattern anywhere in the string, not just as a whole value." Which regex has this problem?