Renderingla

regex

Compile textus patterns to regex via ↦ regex.

Syntax: <textus> ↦ regex

Category

literal

Related

Examples

examples/corpus/literalia/regex.fab (canonical · conversio)

Compile textus patterns to regex via ↦ regex.

# literalia/regex — textus ↦ regex conversio
#
# GRAMMAR:
#   conversio :← stringLit '↦' 'regex'
#   templateExpr :← stringLit '(' exprList ')'   -- then ↦ regex on the textus result
#
# EXPECTED OUTPUT:
#   Regex pattern diagnostics for literals, inline flags, and a template-built path.
#
# BACKEND:
#   Cross-ref lege/lege.fab for regex beside stdin reads.
#   Cross-ref scriptum/scriptum.fab for § template application.

incipit {
    fixum _ digits ← "\d+" ↦ regex
    nota digits

    fixum _ word ← "(?i)\w+" ↦ regex
    nota word

    # Template application → textus, then conversio to regex (dynamic path segments)
    fixum _ tenant ← "acme"
    fixum _ homePath ← "/home/§/.*"(tenant) ↦ regex
    nota homePath
}

Expected output:

\d+
(?i)\w+
/home/acme/.*