feat(stdlib): Mid M1 regex and encoding libraries

Add lib/re and lib/encoding (EN/ZH) backed by host_re_* and
host_encoding_*, with golds, public demos, and design docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-07 20:02:43 +08:00
1 parent 1a5ee57a6f
commit 838a2b425a
26 files changed
+702 -13

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
---
title: lib/encoding
description: Base64 and hex encode/decode (Mid M1). UTF-8 text round-trip.
---
## base64_encode
+ `text`
**> host_encoding_base64_encode text=`text`**
## base64_decode
+ `text`
**> host_encoding_base64_decode text=`text`**
## hex_encode
+ `text`
**> host_encoding_hex_encode text=`text`**
## hex_decode
+ `text`
**> host_encoding_hex_decode text=`text`**
+38
View File
@@ -0,0 +1,38 @@
---
title: lib/re
description: Regular expressions (Mid M1). Unicode; no backreferences.
---
## is_match
+ `text`
+ `pattern`
**> host_re_is_match text=`text` pattern=`pattern`**
## find
+ `text`
+ `pattern`
**> host_re_find text=`text` pattern=`pattern`**
## find_all
+ `text`
+ `pattern`
**> host_re_find_all text=`text` pattern=`pattern`**
## replace
+ `text`
+ `pattern`
+ `with`
+ `count`=None
Optional `count=` limits replacements (`None` = all).
**> host_re_replace text=`text` pattern=`pattern` with=`with` count=`count`**
## split
+ `text`
+ `pattern`
**> host_re_split text=`text` pattern=`pattern`**
+38
View File
@@ -0,0 +1,38 @@
---
title: lib/正则
description: 正则表达式(中层 M1)。Unicode;无回溯引用。
---
## 匹配
+ `内容`
+ `模式`
**> host_re_is_match text=`内容` pattern=`模式`**
## 查找
+ `内容`
+ `模式`
**> host_re_find text=`内容` pattern=`模式`**
## 查找全部
+ `内容`
+ `模式`
**> host_re_find_all text=`内容` pattern=`模式`**
## 替换
+ `内容`
+ `模式`
+ `为`
+ `次数`=None
可选 `次数=` 限制替换次数(缺省 = 全部)。
**> host_re_replace text=`内容` pattern=`模式` with=`为` count=`次数`**
## 拆分
+ `内容`
+ `模式`
**> host_re_split text=`内容` pattern=`模式`**
+24
View File
@@ -0,0 +1,24 @@
---
title: lib/编码
description: Base64 与十六进制编解码(中层 M1)。UTF-8 文本往返。
---
## 基64编码
+ `内容`
**> host_encoding_base64_encode text=`内容`**
## 基64解码
+ `内容`
**> host_encoding_base64_decode text=`内容`**
## 十六进制编码
+ `内容`
**> host_encoding_hex_encode text=`内容`**
## 十六进制解码
+ `内容`
**> host_encoding_hex_decode text=`内容`**