feat(regex): add host-backed groups, alternation and captures
This commit is contained in:
1 parent
94a13880c4
commit
28b178fc70
16 files changed
+289
-8
No files matched your search
+1
-1
@@ -22,7 +22,7 @@ module; a mismatch is a hard error.
|
||||
- `datetime.mq.md` — UTC ISO-8601 format/parse over Unix milliseconds (pure)
|
||||
- `clock.mq.md` — project-mode `clock.now` over `resource.request`
|
||||
- `path.mq.md` — lexical join/basename/dirname/extension/normalize (no I/O)
|
||||
- `regex.mq.md` — `^ $ . * + ? [...]` matcher and search (no groups)
|
||||
- `regex.mq.md` — pure subset matcher + host-backed groups/alternation/captures
|
||||
- `net/http.mq.md` — HTTP/1.1 response parsing (headers/chunked) and request builder
|
||||
- `tests/` — product self-tests for every public module
|
||||
(`clock`, `compress`, `console`, `csv`, `datetime`, `demo`, `env`, `format`, `fs`, `http`,
|
||||
|
||||
@@ -432,3 +432,27 @@
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*成功(结果)*
|
||||
|
||||
## 扩展匹配
|
||||
|
||||
`(模式, 文本)`
|
||||
|
||||
使用宿主正则引擎(支持分组、选择、`\\d` 等)判断是否匹配。模式无效时
|
||||
返回 `regex.invalid`。仅项目模式;纯 `.mq.md` 子集仍由 `匹配`/`搜索` 提供。
|
||||
|
||||
*resource.request("regex.match", [模式, 文本])*
|
||||
|
||||
## 扩展搜索
|
||||
|
||||
`(模式, 文本)`
|
||||
|
||||
*resource.request("regex.match", [模式, 文本])*
|
||||
|
||||
## 捕获
|
||||
|
||||
`(模式, 文本)`
|
||||
|
||||
返回 `{ok:true, value:{matched:Bool, groups:List<Text|None>}}`。下标 0 是
|
||||
完整匹配;未参与匹配的分组是 `None`。
|
||||
|
||||
*resource.request("regex.captures", [模式, 文本])*
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "marqdo-stdlib",
|
||||
"version": "0.1.0",
|
||||
"digest": "sha256:770a63bbd1d3c8a62471c0f0c3cb9ee5647656c137a528442f16e3bd63505d5f"
|
||||
"digest": "sha256:0809bdb27b2d4688aae7c8a2fcd270b88e23fcf33fa9edbd127681fa05f3a4a1"
|
||||
}
|
||||
@@ -27,4 +27,8 @@ import:
|
||||
|
||||
**`不支持 = regex.匹配("(a)", "a")`**
|
||||
|
||||
*[星号.value, 加号.value, 锚点.value, 类.value, 否定类.value, 任意.value, 可选.value, 转义.value, 搜索.value, 无效.ok, 无效.code, 不支持.code]*
|
||||
**扩展 = regex.扩展匹配("^(a+)(b|c)$", "aab")**
|
||||
|
||||
**捕获 = regex.捕获("^(a+)(b|c)$", "aab")**
|
||||
|
||||
*[星号.value, 加号.value, 锚点.value, 类.value, 否定类.value, 任意.value, 可选.value, 转义.value, 搜索.value, 无效.ok, 无效.code, 不支持.code, 扩展.value, 捕获.value.matched, 捕获.value.groups]*
|
||||
Reference in new issue
Block a user