Repository navigation
Releases
mojo-uregex v0.3.3
mojo-uregex-public v0.3.3
Released: 2026-11-08 · Commit: 195d977 · Previous: v0.3.2
What it does
Unicode-aware regular expressions for Mojo, built for the pre-tokenizers of LLM
tokenizers (GPT-2, Llama 3, Qwen, DeepSeek, gpt-oss, Spark-X2.5) and checked
against Python's regex by differential testing. Pure Mojo, CPU. Build with
-I src; requires Mojo 1.2.
Highlights
- Packaging only: the conda recipe pins
mojo-compilerto the minor the package was built with (<1.3.0a0), so it cannot be installed on a Mojo it does not load on.
Changes
Changed
recipe.yaml:mojo-compilerrun dependency pinned to the build's minor (<1.3.0a0).
Verified
| Check | Result |
|---|---|
pkg-conda dry run on the version commit (H1-H3,H6) |
PASS: mojo-uregex-0.3.3-hb0f4dca_0.conda |
Known limits
- Packages are built on one Mojo minor only; see the package protocol.
Upgrade / run
None: no API change.
Commits
195d977build: bump version to 0.3.368476a1build: recipe pins mojo-compiler to the build's minor
mojo-uregex v0.3.2
mojo-uregex-public v0.3.2
Released: 2026-11-04 · Commit: 5428257 · Previous: v0.3.1
What it does
Unicode-aware regular expressions for Mojo, built for the pre-tokenizers of LLM
tokenizers (GPT-2, Llama 3, Qwen, DeepSeek, gpt-oss, Spark-X2.5) and checked
against Python's regex by differential testing. Pure Mojo, CPU. Build with
-I src; requires Mojo 1.2.
Highlights
$matches before a final newline like Python, and\Zand\zare supported.- Patterns Python rejects now raise:
{m,n}withnbelowm,\1..\9and\k<name>backreferences, a trailing\p. - A pattern such as
a{99999999999}raises in milliseconds: the compiled program size is capped.
Changes
Added
$before a final newline,\Zand\z.- The
mojo-uregexskill,docs/api.md,docs/design.mdandscripts/ci.sh. recipe.yaml: a conda package recipe;uv.lockis committed.- CI runs the gate on push and pull request; badges in the README.
Changed
- The compiled program size is capped.
- README: one install block, one example; the gate runs
examples/quickstart.mojo.
Fixed
- A trailing
\praises instead of aborting the process. {m,n}withnbelowmis rejected.\1..\9and\k<name>are rejected, as backreferences are unsupported.- The CI workflow file parsed as invalid YAML; the
uv syncstep is quoted.
Removed
- The unused
to_codepoints.
Verified
| Check | Result |
|---|---|
ci-local at 5428257: the GitHub workflow in a clean Ubuntu 24.04 container, Mojo 1.2.0 |
PASS |
Known limits
- As in v0.3.1.
Upgrade / run
python3 -m venv .venv && ./.venv/bin/pip install 'mojo==1.2.0' 'regex==2026.9.29'
Commits
5428257docs(release): CHANGELOG lists v0.3.2, the release gate reads itde30222fix(ci): quote the uv sync step, the workflow did not parsed85df6ffix(release): pixi.toml, pyproject.toml, recipe.yaml, uv.lock say 0.3.25acd041build: commit uv.lockb1aafcedocs: api.md, design.md, scripts/ci.sh and CI badge19e0fdbdocs(skills): add mojo-uregex skill44a061dbuild: mojo-upgrade config2ce35f9feat(uregex): $ matches before a final newline like Python, add \Z and \zfb2c896build: conda recipe67a0e22fix(uregex): cap the compiled program size, a{99999999999} raises in 40 ms16f1eectest: gate runs examples/quickstart.mojo2202540docs: one example, one install block00fc577ci: run the gate on push and pull request0104174refactor(uregex): delete the unused to_codepoints10bc2e3docs(uregex): Mojo 1.2.0 pins and version 0.3.1 everywhere, README matches the enginef59f89afix(uregex): reject \1..\9 and \k as backreferences938cb27fix(uregex): reject {m,n} with n below m757585dfix(uregex): a trailing \p raises instead of aborting the process8d28cb6docs: latest-release and license badges
mojo-uregex v0.3.1
mojo-uregex v0.3.1
Released: 2026-10-29 · Commit: 3222bf2 · Previous: v0.3.0
What it does
Unicode-aware regular expressions for Mojo, built for the pre-tokenizers of LLM
tokenizers (GPT-2, Llama 3, Qwen, DeepSeek, gpt-oss, Spark-X2.5) and checked
against Python's regex by differential testing. Pure Mojo, CPU. Build with
-I src; requires Mojo 1.2.
Highlights
- Builds and runs on the stable Mojo 1.2.0 release.
Changes
Changed
- The pin moves to Mojo 1.2.0 (
pyproject.toml); README says Mojo 1.2.
Fixed
- The library did not build on Mojo 1.2.0:
String(StringSlice(unsafe_from_utf8=...))sends the compiler into a recursion. It now usesString(unsafe_from_utf8=...), which builds on 1.1 and 1.2.
Verified
| Check | Result |
|---|---|
README setup in an empty directory (mojo==1.2.0), then tools/gate.sh |
PASS, 14/14 tests, every differential run |
Known limits
- As in v0.3.0.
Upgrade / run
python3 -m venv .venv && ./.venv/bin/pip install 'mojo==1.2.0' 'regex==2026.9.29'
Commits
3222bf2build: Mojo 1.2.0b4f718cfix: String(unsafe_from_utf8=X) instead of wrapping StringSlicefec09c0docs: NOTICE names the owner and contact
uregex 0.3.0
mojo-uregex v0.3.0
Released: 2026-10-08 · Previous: first release in this repository
What it does
Unicode-aware regular expressions for Mojo, built for the pre-tokenizers of LLM
tokenizers (GPT-2, Llama 3, Qwen, DeepSeek, gpt-oss, Spark-X2.5) and checked
against Python's regex by differential testing. Pure Mojo, CPU. Build with
-I src; requires Mojo 1.1.
Highlights
- 1.9 to 3.1x faster than Python
regexon the tokenizer patterns (tools/bench.sh); slowest on plain-ASCII GPT-2 text. - Two engines from one source:
Patternfor tokenizers,FullPatternfor capture groups, named groups,\b\Band fixed-length lookbehind. - Byte offsets on UTF-8 input with no copy to codepoints; codepoint offsets on request.
- Unicode 18.0 general categories and case maps, generated from the Unicode Character Database by
tools/gen_unicode.mojoand checked against Pythonregex.
Changes
First release in this repository. Public API:
Pattern(src),FullPattern(src):findall,findall_spans,findall_cps_offsets,search,split_keep;FullPatternaddsfindall_groups,groups(),group_index(name).- One-shot helpers
findall,search,split_keep,compile(full syntax). - Supported and rejected syntax: README, "Supported syntax".
Verified
| Check | Result |
|---|---|
tools/gate.sh: unit tests, check_unicode.py (every table vs regex 2026.9.29), difftest (every pattern in tools/difftest.py x 5004 random texts, codepoint and byte offsets), negative control |
PASS: 14/14 tests, 41 tables equal, every pattern equal in both offset modes, negative control caught every pattern |
tools/bench.sh: match counts equal Python regex on every tokenizer pattern |
agree on all 6 |
Fresh clone: README setup run top to bottom in an empty directory, then tools/gate.sh |
PASS: mojo==1.1.0 and regex==2026.9.29 from PyPI, full gate green |
Known limits
- Backtracking engine: pathological patterns can be exponential.
- No backreferences, possessive quantifiers or variable-length lookbehind.
FullPatternis slower thanPatternfor the same pattern; usePatternunless you need its syntax.- Positions are Int32 internally: inputs over 2 GiB are not supported.
Upgrade / run
python3 -m venv .venv && ./.venv/bin/pip install 'mojo==1.1.0' 'regex==2026.9.29'
./.venv/bin/mojo run -I src tests/test_uregex.mojo
tools/gate.sh
Commits
uregex 0.3.0: initial public commit.