Perl-style NFA Regex

Regex + Stringr Integration

Thompson NFA engine with O(n·m) worst-case — no catastrophic backtracking.
14 stringr functions, 5 regex flags (i/m/s/x/g), all integrated with TidyView.

regex_demo.cjcl
// Perl-style regex with ~= operator
let email = "alice@company.com";
print(email ~= /\w+@\w+\.\w+/);
// → true

// Date validation
let date = "2026-04-15";
print(date ~= /\d\d\d\d-\d\d-\d\d/);
// → true

// Case-insensitive flag
let text = "Hello World";
print(text ~= /hello/i);
// → true

// Not-match operator
let safe = "clean input";
print(safe !~ /[<>]/);
// → true

// Regex in conditionals
let log = "ERROR: connection timeout";
if log ~= /^ERROR/ {
    print("Error detected in log!");
}
// Type-safe validation functions
fn validate_email(s: String) -> Bool {
    return s ~= /\w+@\w+\.\w+/;
}

fn is_numeric(s: String) -> Bool {
    return s ~= /^\d+$/;
}

print(validate_email("bob@example.org"));
// → true
print(validate_email("not-an-email"));
// → false

// Stringr functions (tidyverse-style)
print(str_replace("hello world", "world", "CJC-Lang"));
// → hello CJC-Lang

print(str_detect("data science", "science"));
// → true

print(str_count("abracadabra", "a"));
// → 5

print(str_sub("CJC-Lang", 0, 3));
// → CJC
▶ Terminal Output — cjcl run regex_demo.cjcl
true                          ← email matches \w+@\w+\.\w+
true                          ← date matches \d\d\d\d-\d\d-\d\d
true                          ← case-insensitive /hello/i
true                          ← !~ no special chars
Error detected in log!        ← conditional on ^ERROR
true                          ← bob@example.org valid
false                         ← "not-an-email" invalid
hello CJC-Lang                ← str_replace
true                          ← str_detect
5                             ← str_count("abracadabra","a")
CJC                           ← str_sub(0..3)
14 Stringr Functions
5 Regex Flags
O(n·m) Worst-Case Guarantee
0 Backtracking Risk
2 Executors (Parity)