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>
39 lines
698 B
Markdown
39 lines
698 B
Markdown
---
|
|
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=`模式`**
|