UCE Test: Regular Expressions

UCE regex functions use PCRE2 and return ordinary UCE strings, lists, and DValue values.

sample = Contact ops@example.test or tag #uce, #docs, and café.

Validation And Search

regex_match("[A-Z][a-z]+", "Alice") true pass
regex_match("[A-Z][a-z]+", "Alice!") false pass
regex_search("example", text)["matched"] true pass
first_email["match"] ops@example.test pass
first_email["named"]["user"] ops pass
first_email["named"]["host"] example.test pass
regex_match("\\p{L}+", "café") true pass

All Matches

regex_search_all hashtags count 2.000000 pass
first hashtag uce pass
second hashtag docs pass

Replace And Split

regex_replace("#([A-Za-z0-9_]+)", "<tag>$1</tag>", "#uce") <tag>uce</tag> pass
join(regex_split("\\s*,\\s*", ...), "|") uce|components|markdown pass
case-insensitive flag UCE pass

Structured Result

{"captures": [{"end": 24.000000, "index": 0.000000, "matched": true, "start": 8.000000, "text": "ops@example.test"}, {"end": 11.000000, "index": 1.000000, "matched": true, "start": 8.000000, "text": "ops"}, {"end": 24.000000, "index": 2.000000, "matched": true, "start": 12.000000, "text": "example.test"}], "end": 24.000000, "flags": "default", "match": "ops@example.test", "matched": true, "named": {"host": "example.test", "user": "ops"}, "named_offsets": {"host": {"end": 24.000000, "index": 2.000000, "start": 12.000000}, "user": {"end": 11.000000, "index": 1.000000, "start": 8.000000}}, "pattern": "(?<user>[A-Za-z0-9._%+-]+)@(?<host>[A-Za-z0-9.-]+)", "start": 8.000000}

Read the regex API documentation