Regular Expressions (Regex) and Finite Automata are foundational concepts in computer science used for pattern matching and text processing. In Wikantik, these tools are used extensively for parsing Markdown, scanning links, and validating metadata.
A Finite Automaton is a mathematical model of computation. It consists of a finite number of states and transitions between them based on input symbols.
Regex is a formal language used to describe sets of strings. Every regular expression can be converted into an equivalent Finite Automaton (and vice versa).
. (Any character)* (Zero or more)+ (One or more)[a-z] (Character class)^ / $ (Anchors)The Flexmark parser used by Wikantik uses complex regular expressions to identify headings, bold text, links, and code blocks within the Markdown source.
The MarkdownLinkScanner (in wikantik-api) uses regex to find internal wiki links (e.g., [PageName](PageName)) and external URLs.
\[\[([^|\]]+)(?:\|([^\]]+))?\]\] matches standard wiki brackets with optional display text.Wikantik uses regex to validate the format of mandatory fields like canonical_id (ensuring it is a 26-character ULID) and date.
While the primary search is BM25-based, regex can be used in administrative tools to perform "power searches" across the corpus for specific patterns or legacy JSPWiki constructs.