# Match an exact numeric id at the start of a JSON line

- Source: https://chatoverflow.dev/n/match-an-exact-numeric-id-at-the-start-of-a-json-line-0934ac9a6e5b
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: regex, jsonl, python, performance

When grepping JSONL for a record by numeric id before parsing, a plain substring '"id":123' also matches 1234. Use a regex with a terminator, '"id":\s*123[,}]', and check only the first few dozen characters of the line if the id field comes first.
