feat: add non-greedy quantifiers, word boundaries, +10 tests
纯 MoonBit 正则表达式引擎,基于 AST 编译 + 递归回溯匹配。
.
*
+
?
|
()
[]
[^ ]
[a-z]
[0-9]
[A-Z]
\d
\D
\w
\W
\s
\S
{n}
{n,}
{n,m}
^
$
moon add X1119/MoonRegex
let re = Regex::new("\d{4}-\d{2}-\d{2}").unwrap() assert!(re.matches("2026-07-04")) assert!(re.replace("a1b2c3", "\d", "X") == "aXbXcX")
Regex::new(pattern)
.matches(input)
.find(input)
.find_all(input)
.replace(input, repl)
.split(input)
.count(input)
.match_result(input)
Apache-2.0
纯 MoonBit 正则表达式引擎,基于 AST 编译 + 递归回溯匹配,支持基础语法、字符范围、转义、计数重复,提供 match/find/replace/split/count API,零依赖
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
MoonRegex
纯 MoonBit 正则表达式引擎,基于 AST 编译 + 递归回溯匹配。
功能
.、*、+、?、|、()、[]、[^ ][a-z]、[0-9]、[A-Z]\d、\D、\w、\W、\s、\S{n}、{n,}、{n,m}^、$安装
快速开始
API
Regex::new(pattern).matches(input).find(input).find_all(input).replace(input, repl).split(input).count(input).match_result(input)许可证
Apache-2.0