chính_quy
Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.
Compile văn_bản patterns to regex via ↦ regex.
Syntax: <văn_bản> ↦ chính_quy
Category#
literal
Related#
Examples#
radix/corpus/literalia/regex.fab (canonical · conversio)#
Compile văn_bản patterns to regex via ↦ regex.
# =============================================================================
# chính_quy — Compile văn_bản patterns to chính_quy via ↦ chính_quy.
# =============================================================================
#
# What this teaches:
# • converting văn_bản strings to compiled chính_quy with `↦ chính_quy`
# • inline chính_quy flags like `(?i)` for case-insensitive matching
# • combining `§` template application with chính_quy chuyển for dynamic patterns
#
# Common mistakes:
# • Forgetting that ↦ chính_quy requires a văn_bản or ascii source — số and other types must convert to văn_bản first.
#
# See also: đọc, chuyển_đổi, văn_bản_hóa
# =============================================================================
# literalia/regex — văn_bản ↦ chính_quy chuyển_đổi
#
# GRAMMAR:
# chuyển_đổi :← stringLit '↦' 'chính_quy'
# templateExpr :← stringLit '(' exprList ')' -- then ↦ chính_quy on the văn_bản result
#
# EXPECTED OUTPUT:
# Regex pattern diagnostics for literals, inline flags, and a template-built path.
#
# BACKEND:
# Cross-ref đọc/lege.fab for chính_quy beside stdin reads.
# Cross-ref văn_bản_hóa/scriptum.fab for § template application.
main {
const chính_quy digits ← "\d+" ↦ chính_quy
print digits
const chính_quy word ← "(?i)\w+" ↦ chính_quy
print word
# Template application → văn_bản, then chuyển_đổi to chính_quy (dynamic path segments)
const string tenant ← "acme"
const chính_quy homePath ← "/home/§/.*"(tenant) ↦ chính_quy
print homePath
}Expected output:
\d+
(?i)\w+
/home/acme/.*