تعبير
Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.
Compile نص patterns to regex via ↦ regex.
Syntax: <نص> ↦ تعبير
Category#
literal
Related#
Examples#
radix/corpus/literalia/regex.fab (canonical · conversio)#
Compile نص patterns to regex via ↦ regex.
# =============================================================================
# تعبير — Compile نص patterns to تعبير via ↦ تعبير.
# =============================================================================
#
# What this teaches:
# • converting نص strings to compiled تعبير with `↦ تعبير`
# • inline تعبير flags like `(?i)` for case-insensitive matching
# • combining `§` template application with تعبير حوّل for dynamic patterns
#
# Common mistakes:
# • Forgetting that ↦ تعبير requires a نص or أسكي source — عدد and other types must convert to نص first.
#
# See also: اقرأ, تحويل, حرر
# =============================================================================
# literalia/regex — نص ↦ تعبير تحويل
#
# GRAMMAR:
# تحويل :← stringLit '↦' 'تعبير'
# templateExpr :← stringLit '(' exprList ')' -- then ↦ تعبير on the نص result
#
# EXPECTED OUTPUT:
# Regex pattern diagnostics for literals, inline flags, and a template-built path.
#
# BACKEND:
# Cross-ref اقرأ/lege.fab for تعبير beside stdin reads.
# Cross-ref حرر/scriptum.fab for § template application.
main {
const تعبير digits ← "\d+" ↦ تعبير
print digits
const تعبير word ← "(?i)\w+" ↦ تعبير
print word
# Template application → نص, then تحويل to تعبير (dynamic path segments)
const string tenant ← "acme"
const تعبير homePath ← "/home/§/.*"(tenant) ↦ تعبير
print homePath
}Expected output:
\d+
(?i)\w+
/home/acme/.*