Verified 2026-09-18

BibTeX Entry Extractor

Captures the entry type, citation key, and body of a BibTeX record to normalize or repair it.

Normalizes mixed brace and parenthesis entries into the standard @type{key, body} form with a find-and-replace.

regexcitationcleanup

Find

@(\w+)\s*[{(]([^,\s]+)\s*,([\s\S]*?)[})]

Replace

@$1{$2,$3}

The body group uses a lazy [\s\S]*? so an entry stops at its first closing brace and repeated finds process a whole bibliography one record at a time.

Common mistakes

  • Using .* with a non-dotall engine, which stops at the first line break and truncates the body.
  • Matching the body greedily, which swallows every following entry in the file into one match.
Permalink: https://merginit.com/reference/regex/bibtex-entry