{
  "id": 23427817,
  "title": "Splitting Pasted Records Without Breaking URLs: Delimiter Detection in JavaScript",
  "url": "https://urgent.news/2026/12/04/splitting-pasted-records-without-breaking-urls-delimiter-detection-in",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-04T11:07:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/jian_thomas_3306d5266f6f5/splitting-pasted-records-without-breaking-urls-delimiter-detection-in-javascript-18oa"
  },
  "original_language": null,
  "account": "In the digital world, multi-field records are often copied into browser tools, containing various pieces of information such as an ID, password, 2FA secret, email address, and cookie string. These fields can be connected using various delimiters like |, ----, tabs, colons, or semicolons, which vary depending on the source of the data. To address this issue, a team of developers created a small browser-only formatter that simplifies the process of splitting lines, extracting specific columns, and removing duplicate entries.\n\nThe parsing process is built on several key decisions. First, strong delimiters are prioritized over weak delimiters. Strong delimiters include characters such as ----, |, and tabs, which rarely appear inside a value. If a strong delimiter is present, it is used as the separator. Weak delimiters consist of ;, :, and ,. If a weak delimiter is present, whichever appears first in the line is chosen. This is achieved using a regular expression with a negative lookahead, ensuring that a colon followed by // is not mistaken for a separator.\n\nNext, the formatter splits the line based on the selected delimiter. The splitLine function accepts a line and an optional separator. If no separator is provided, it uses the detectSeparator function to determine the appropriate delimiter. The split function accepts a regular expression, allowing the negative lookahead to prevent URLs from being split incorrectly. The resulting array is then trimmed for whitespace.\n\nThe ID is extracted by attempting to match the most specific shape first. The ID can be found in different contexts, such as the first field, part of a profile URL, or within a cookie string like c_user=. The function looks for the ID in various formats, starting with the most specific shape, which is the most specific pattern. After finding a match, the function proceeds to search for alternative patterns. This approach ensures the most accurate extraction of the ID.\n\nIf there are duplicate IDs, they are removed without altering the order of the remaining entries. A Set is used to track seen IDs, while an array maintains the original order. The function iterates through each line and extracts the ID using the previously mentioned extractId function. If an ID is found and hasn't been previously encountered, it is added to both the Set and the output array.",
  "summary": "Our team pastes multi-field records into a browser tool every day: an ID, a password, a 2FA secret, an email, a cookie string. Depending on who exported them, the fields are glued together with | , ---- , tabs, colons or semicolons. We built a small browser-only formatter that splits these lines, pulls out one column and removes duplicates. These are the parsing decisions that mattered, with code…",
  "summary_source": "publisher",
  "key_points": [
    "Strong delimiters like ----, |, and tabs prioritize over weak delimiters",
    "Weak delimiters include ;, :, and ,; first appearing delimiter chosen",
    "IDs extracted with highest specificity, duplicates removed without reordering"
  ],
  "editors_take": "This new tool helps developers process multi-field data more accurately by preventing common errors when separating information that contains web addresses.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}