Skip to content

ID regex and alphabetic index

F Lengyel edited this page Oct 7, 2023 · 12 revisions

ZKID.0.23.0225 ID format

My Zettel IDs are alphanumeric and satisfy the following regex:

((\w{1,4}\.){2,}\d\w{3})

This says, "at least two dot-delimited nonempty sequences of alphanumeric characters each of length at most four, followed by a sequence of consisting of one digit followed by three alphanumeric characters." This regex was chosen after some experimentation. One consideration was to avoid matching non-ID text in any document.

In Zettlr, the regex above replaces the default regex in Preferences --> Zettelkasten --> ID regular expression. In the same Preferences page, the "Pattern used to create new IDs" becomes %Y.%M%D.%h%m. I rename the filenames this ID pattern generates.


Alphabetic index

The alphabetic index appears at the beginning of the file pane in Zettlr (the file explorer in Obsidian).

Note that the IDs satisfy the ID regex. The first H1 header of each note follows the Zettel format template.

# 0000.0000.0000 INDEX
# 0000.0000.0ABC A-B-C
# 0000.0000.0CDE C-D-E
# 0000.0000.0FGH F-G-H
# 0000.0000.0IJK I-J-K
# 0000.0000.0LMN L-M-N
# 0000.0000.0PQR P-Q-R
# 0000.0000.0STU S-T-U
# 0000.0000.0VWX V-W-X
# 0000.0000.00YZ Y-Z
# 0000.0000.0009 0-9

Some sample H1 headers from my own Zettelkasten

# LTeX.2e.0.22.0407 Mike Shulman's twocell code
# LTeX.2f.0.2022.0411 Modifying tabularray +bmatrix with environ
# Math.0.23.0208 A homeomorphism with Baire space
# Math.3f.0.22.0719 Lebesgue Covering Lemma
# LoRa.2c2b.1a.0.23.0525 Flashing the Nano G1 Explorer