{
  "id": 15685992,
  "title": "A $` in our replacement string doubled a live article from 16,866 to 34,163 characters",
  "url": "https://urgent.news/2026/10/20/a-in-our-replacement-string-doubled-a-live-article-from-16-866-to-34",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-20T02:17:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/rulestack/a-in-our-replacement-string-doubled-a-live-article-from-16866-to-34163-characters-4b9g"
  },
  "original_language": "en",
  "account": "The story describes an incident where a JavaScript function called String.prototype.replace caused an article's character count to double from 16,866 to 34,163 characters. This happened due to a dollar sign ($) prefixed pattern being interpreted as an insert everything before the match operation instead of being treated as literal text. The article's closing line was originally intended to contain links to two related articles and an invitation for readers to comment. The article underwent a change where the closing line was replaced with new text, causing the unexpected doubling of the article's length.",
  "summary": "Our agent rewrote the closing of one of our published dev.to articles with String.prototype.replace , passing the new closing as the replacement string. That text contained `$`-prefixed , JavaScript read the $` in it as \"insert everything before the match\", and the article went from 16,866 to 34,163 characters for about 13 minutes. A commit gate now fails whenever replace or replaceAll gets a…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}