This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/dev/pr-13148-9f3f7c2d03f32ea116139885050381a86234a7ef
in repository https://gitbox.apache.org/repos/asf/seatunnel.git

commit 38ecc5df57a5fe888b0ce18dcf7bd37cc2867ee1
Author: Prasad Dimba Anandappa 
<[email protected]>
AuthorDate: Tue Nov 17 15:49:30 2026 +0000

    [Docs][Transform-V2] Rewrite RegexExtract documentation (#13148)
    
    Signed-off-by: Prasad Dimba Anandappa <[email protected]>
---
 docs/en/transforms/regexextract.md | 285 +++++++++++++++++++++++++++++++-----
 docs/zh/transforms/regexextract.md | 287 ++++++++++++++++++++++++++++++++-----
 2 files changed, 497 insertions(+), 75 deletions(-)

diff --git a/docs/en/transforms/regexextract.md 
b/docs/en/transforms/regexextract.md
index 6680d571e3..91a3c15981 100644
--- a/docs/en/transforms/regexextract.md
+++ b/docs/en/transforms/regexextract.md
@@ -2,75 +2,199 @@
 
 > RegexExtract transform plugin
 
+## Support Those Engines
+
+> Spark<br/>
+> Flink<br/>
+> Seatunnel Zeta<br/>
+
 ## Description
 
-The `RegexExtract` transform plugin uses regular expressions to extract data 
from a specified field and outputs the extracted values to new fields. It 
supports capture groups in regex patterns and allows setting default values for 
each output field when the pattern doesn't match.
+The RegexExtract transform uses a Java regular expression to extract data from 
one input field and writes the value of each capture group to a new output 
field. It is typically used to split semi-structured strings such as email 
addresses, log lines or file paths into separate columns during ingestion. When 
the pattern does not match, or the input value is null, each output field 
receives its configured default value instead (or null when no default is 
configured). RegexExtract supports  [...]
+
+## Key Features
+
+- Extract one capture group per output field from a single source field
+- The pattern is searched in the value (`Matcher#find`), so it does not have 
to match the whole value
+- `default_values` provide a fallback for null values and non-matching values
+- The produced columns are always `STRING` columns and are appended after the 
input columns; the original field is kept
+- Works on multiple tables in one transform, see [Multi-Table 
Transform](transform-multi-table.md)
 
 ## Options
 
-| name           | type    | required | default value |
-|----------------|---------|----------|---------------|
-| source_field   | string  | yes      |               |
-| regex_pattern  | string  | yes      |               |
-| output_fields  | array   | yes      |               |
-| default_values | array   | no       |               |
+| Name              | Type               | Required | Default       | 
Description                                                                     
                     |
+|-------------------|--------------------|----------|---------------|------------------------------------------------------------------------------------------------------|
+| source_field      | String             | yes      | -             | Input 
field to extract from. It must exist in the input table.                        
               |
+| regex_pattern     | String             | yes      | -             | Regular 
expression with capture groups. The number of capture groups must equal the 
number of `output_fields`. |
+| output_fields     | Array&lt;String&gt; | yes      | -             | Names 
of the output fields, in capture group order. The list must not be empty.       
               |
+| default_values    | Array&lt;String&gt; | no       | -             | Default 
value per output field, used when the pattern does not match or the source 
value is null. When set, its length must equal the length of `output_fields`. |
+| table_match_regex | String             | no       | `.*`          | Regex of 
the table paths that the transform level rule applies to.                       
            |
+| table_transform   | Array&lt;Map&gt;    | no       | -             | 
Per-table rules, see [Multi-Table Transform](transform-multi-table.md).         
                     |
+| rule_match_mode   | String             | no       | `FIRST_MATCH` (duplicate 
`table_path` entries are rejected unless set explicitly) | How multiple 
`table_transform` entries with the same `table_path` are evaluated.             
        |
+| common options    | -                  | no       | -             | 
Transform plugin common parameters, see [Transform 
Plugin](common-options/common-options.md).       |
 
-### source_field [string]
+:::info
 
-The source field name to extract data from.
+`source_field`, `regex_pattern` and `output_fields` are required in every 
rule. In a multi-table configuration, the transform level rule can be omitted, 
but each `table_transform` entry must still contain all three options. Tables 
without a matching entry are passed through unchanged.
 
-### regex_pattern [string]
+:::
 
-The regular expression pattern with capture groups. The number of capture 
groups must match the number of output fields.
+### source_field [String]
 
-### output_fields [array]
+The name of the input field to extract from. The value is converted with 
`toString()` before matching, so fields of other types are accepted as well.
 
-The names of the output fields for extracted values. The size must match the 
number of capture groups in the regex pattern.
+The field must exist in the input table. Otherwise the job fails with error 
code `TRANSFORM_COMMON-01`: `The input field 'email' of 'RegexExtract' 
transform not found in upstream schema`.
 
-### default_values [array]
+### regex_pattern [String]
 
-Default values for output fields when the regex pattern does not match or the 
source field is null. If provided, the size must match the number of output 
fields.
+The Java regular expression, compiled with `java.util.regex.Pattern`. It must 
contain one capture group per entry of `output_fields`: if the number of 
capture groups differs from the number of output fields, the job fails when the 
transform is created.
 
-### common options [string]
+The pattern is applied with `Matcher#find`, which means it is searched 
anywhere in the value and does not need to match the whole value; the first 
match is used. A capture group that does not take part in the match produces 
`null` for its output field.
 
-Transform plugin common parameters, please refer to [Transform 
Plugin](common-options/common-options.md) for details
+Because the pattern is written inside a HOCON string, backslashes must be 
escaped, for example `regex_pattern = "([^@]+)@([^.]+)\\.(.+)"`.
 
-## Example
+### output_fields [Array&lt;String&gt;]
 
-The data read from source is a table like this:
+The names of the fields produced by the transform, in capture group order: the 
first output field receives capture group 1, the second receives capture group 
2, and so on. The list must not be empty.
 
-| id | email              | log_entry                                          
  |
-|----|--------------------|------------------------------------------------------|
-| 1  | [email protected]  | 2023-12-01 10:30:45 INFO User login successful     
  |
-| 2  | [email protected]     | 2023-12-01 11:15:22 ERROR Database connection 
failed |
-| 3  | [email protected]   | 2023-12-01 12:00:00 WARN Memory usage high         
  |
+New output columns are appended after the existing input columns; the input 
field is not removed. Every column appended this way is a nullable `STRING` 
column with length 200. If an output field name already exists in the input 
table, that column is reused and overwritten instead of appended: the extracted 
value replaces its value, but the column keeps its original schema metadata — 
in particular, a reused column does not automatically become nullable or change 
its length. The only metad [...]
 
-We want to extract username, domain, and top-level domain from the `email` 
field:
+### default_values [Array&lt;String&gt;]
+
+The fallback value for each output field, in the same order as 
`output_fields`. The defaults are used in two cases:
+
+- the source value is `null`;
+- the source value does not match `regex_pattern`.
+
+When `default_values` is set, its length must equal the length of 
`output_fields`, otherwise the configuration is rejected. When it is not set, 
output fields receive `null` in both cases above.
+
+### table_match_regex [String]
+
+A regular expression matched against the upstream table path. The transform 
level rule (`source_field`, `regex_pattern`, `output_fields` and 
`default_values` outside of `table_transform`) is applied only to the tables 
that match. The default `.*` matches every table. Tables that match neither 
this regex nor a `table_transform` entry are passed through unchanged.
+
+Note that this refers to the real upstream table name, not to `plugin_output`.
+
+### table_transform [Array&lt;Map&gt;]
+
+A list of per-table rules. Each entry must contain `table_path` in the form 
`databaseName[.schemaName].tableName` (matched exactly) and a complete 
RegexExtract rule for that table, which means `source_field`, `regex_pattern` 
and `output_fields`, plus `default_values` when needed.
+
+When a table has an entry in `table_transform`, the transform level rule is 
not applied to it. See [Multi-Table Configuration](#multi-table-configuration).
+
+### rule_match_mode [String]
+
+Controls what happens when several `table_transform` entries have the same 
`table_path`. Supported values are `FIRST_MATCH` (apply only the first matching 
entry) and `ALL_MATCH` (apply all matching entries in order, each one receiving 
the output of the previous one).
+
+If `rule_match_mode` is not set, duplicate `table_path` entries are rejected. 
Set it explicitly to `FIRST_MATCH` or `ALL_MATCH` when several entries use the 
same `table_path`.
+
+### common options
+
+Transform plugin common parameters, please refer to [Transform 
Plugin](common-options/common-options.md) for details.
+
+## Multi-Table Configuration
+
+When the upstream source outputs several tables (for example JDBC or 
MySQL-CDC), one RegexExtract transform can handle all of them.
+
+- Entries in `table_transform` take precedence over the transform level rule. 
A table that has an entry is never touched by the transform level rule.
+- Every entry must be a complete single-table rule (`table_path` plus 
`source_field`, `regex_pattern` and `output_fields`).
+- The transform level rule applies only to tables matching `table_match_regex`.
+- When only `table_transform` is configured, the tables without an entry stay 
unchanged.
+
+The configuration below uses a transform level rule for `test.a.*` tables, a 
per-table rule for `test.xyz`, and leaves `test.www` unchanged:
+
+```hocon
+env {
+  parallelism = 1
+  job.mode = "BATCH"
+}
+
+source {
+  FakeSource {
+    plugin_output = "fake"
+    tables_configs = [
+      {
+        row.num = 2
+        schema = {
+          table = "test.abc"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.abcd"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.xyz"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.www"
+          fields { id = int, email = string }
+        }
+      }
+    ]
+  }
+}
 
-```
 transform {
   RegexExtract {
     plugin_input = "fake"
-    plugin_output = "regex_result"
+    plugin_output = "fake1"
+
+    table_match_regex = "test.a.*"
     source_field = "email"
     regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
-    output_fields = ["username", "domain", "tld"]
-    default_values = ["unknown", "unknown", "unknown"]
+    output_fields = [username, domain, tld]
+
+    table_transform = [
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+
+sink {
+  Console {
+    plugin_input = "fake1"
   }
 }
 ```
 
-Then the data in result table `regex_result` will be:
+Result schema of each table:
 
-| id | email              | log_entry                                          
  | username | domain  | tld |
-|----|--------------------|------------------------------------------------------|----------|---------|-----|
-| 1  | [email protected]  | 2023-12-01 10:30:45 INFO User login successful     
  | user1    | example | com |
-| 2  | [email protected]     | 2023-12-01 11:15:22 ERROR Database connection 
failed | admin    | test    | org |
-| 3  | [email protected]   | 2023-12-01 12:00:00 WARN Memory usage high         
  | guest    | domain  | net |
+| Table      | Rule applied                              | Output fields       
             |
+|------------|-------------------------------------------|----------------------------------|
+| test.abc   | transform level rule (matches `test.a.*`) | id, email, 
username, domain, tld |
+| test.abcd  | transform level rule (matches `test.a.*`) | id, email, 
username, domain, tld |
+| test.xyz   | `table_transform` entry                   | id, email, 
username, host        |
+| test.www   | none                                      | id, email           
             |
 
-## Job Config Example
+## Example
 
-```
+### Single table
+
+The data read from source is a table like this:
+
+| id | email             | log_entry                                           
 |
+|----|-------------------|------------------------------------------------------|
+| 1  | [email protected] | 2023-12-01 10:30:45 INFO User login successful      
 |
+| 2  | [email protected]    | 2023-12-01 11:15:22 ERROR Database connection 
failed |
+| 3  | [email protected]  | 2023-12-01 12:00:00 WARN Memory usage high          
 |
+
+We want to extract username, domain, and top-level domain from the `email` 
field:
+
+```hocon
 env {
   job.mode = "BATCH"
 }
@@ -121,5 +245,92 @@ sink {
 }
 ```
 
+Then the data in result table `regex_result` will be:
+
+| id | email             | log_entry                                           
 | username | domain  | tld |
+|----|-------------------|------------------------------------------------------|----------|---------|-----|
+| 1  | [email protected] | 2023-12-01 10:30:45 INFO User login successful      
 | user1    | example | com |
+| 2  | [email protected]    | 2023-12-01 11:15:22 ERROR Database connection 
failed | admin    | test    | org |
+| 3  | [email protected]  | 2023-12-01 12:00:00 WARN Memory usage high          
 | guest    | domain  | net |
+
+A row whose `email` does not match the pattern, or is `null`, would get 
`unknown` for all three output fields because `default_values` is configured 
here. Without `default_values`, the three output fields would be `null` for 
such a row.
+
+### Multiple tables
+
+The `env`, `source` and `sink` blocks are the same as in [Multi-Table 
Configuration](#multi-table-configuration). Only the `transform` block changes. 
Assume the source outputs `test.abc`, `test.abcd`, `test.xyz` and `test.www`, 
each with the fields `id` and `email`.
+
+**1. Transform level rule only.** The rule applies to every table because 
`table_match_regex` defaults to `.*`.
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    source_field = "email"
+    regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+    output_fields = [username, domain, tld]
+  }
+}
+```
+
+**2. Transform level rule plus per-table rules.** See the complete job in 
[Multi-Table Configuration](#multi-table-configuration).
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    table_match_regex = "test.a.*"
+    source_field = "email"
+    regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+    output_fields = [username, domain, tld]
+    table_transform = [
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+```
+
+**3. Per-table rules only.** The transform level rule can be omitted; tables 
without an entry are passed through unchanged.
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    table_transform = [
+      {
+        table_path = "test.abc"
+        source_field = "email"
+        regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+        output_fields = [username, domain, tld]
+      },
+      {
+        table_path = "test.abcd"
+        source_field = "email"
+        regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+        output_fields = [username, domain, tld]
+      },
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+```
+
+`test.www` has no matching entry and is passed through unchanged.
+
 ## Changelog
 
+### new version
+
+- Add RegexExtract Transform Plugin
diff --git a/docs/zh/transforms/regexextract.md 
b/docs/zh/transforms/regexextract.md
index 9ba3766f58..04abb71de0 100644
--- a/docs/zh/transforms/regexextract.md
+++ b/docs/zh/transforms/regexextract.md
@@ -2,75 +2,199 @@
 
 > 正则提取转换插件
 
+## 支持的引擎
+
+> Spark<br/>
+> Flink<br/>
+> Seatunnel Zeta<br/>
+
 ## 描述
 
-`RegexExtract` 
转换插件使用正则表达式从指定字段中提取数据,并将提取的值输出到新字段中。它支持正则表达式中的捕获组,并允许在模式不匹配时为每个输出字段设置默认值。
+RegexExtract 转换使用 Java 
正则表达式从一个输入字段中提取数据,并将每个捕获组的值写入一个新的输出字段。它通常用于在数据接入过程中,把电子邮件地址、日志行、文件路径等半结构化字符串拆分为独立的列。当模式不匹配,或者输入值为
 null 时,每个输出字段会改用其配置的默认值(未配置默认值时为 null)。RegexExtract 支持多表配置,参见 [多表配置](#多表配置)。
 
-## 属性
+## 主要特性
 
-| 名称              | 类型       | 是否必须     | 默认值   |
-|-----------------|----------|----------|-------|
-| source_field    | string   | yes      |       |
-| regex_pattern   | string   | yes      |       |
-| output_fields   | array    | yes      |       |
-| default_values  | array    | no       |       |
+- 从单个源字段中按捕获组逐个提取输出字段
+- 模式是在值中搜索的(`Matcher#find`),不必匹配整个值
+- `default_values` 为 null 值和不匹配的值提供兜底结果
+- 生成的列始终是 `STRING` 类型,并追加在输入列之后,原字段会保留
+- 一个转换即可处理多张表,参见 [多表转换](transform-multi-table.md)
 
-### source_field [string]
+## 选项
 
-要提取数据的源字段名称。
+| 名称                | 类型             | 是否必须 | 默认值           | 描述               
                                        |
+|-------------------|----------------|------|---------------|----------------------------------------------------------|
+| source_field      | String         | 是    | -             | 
需要提取数据的输入字段,必须存在于输入表中。                                    |
+| regex_pattern     | String         | 是    | -             | 
带捕获组的正则表达式。捕获组的数量必须与 `output_fields` 的数量相等。                                |
+| output_fields     | Array&lt;String&gt; | 是    | -             | 
输出字段的名称,按捕获组顺序排列。列表不能为空。                                |
+| default_values    | Array&lt;String&gt; | 否    | -             | 
每个输出字段的默认值,在模式不匹配或源值为 null 时使用。设置时,其长度必须与 `output_fields` 的长度相等。 |
+| table_match_regex | String         | 否    | `.*`          | 
转换级别规则所适用的表路径的正则表达式。                                     |
+| table_transform   | Array&lt;Map&gt;    | 否    | -             | 针对单表的规则,参见 
[多表转换](transform-multi-table.md)。             |
+| rule_match_mode   | String         | 否    | `FIRST_MATCH`(未显式设置时,重复的 
`table_path` 条目会被拒绝) | 当多个 `table_transform` 条目的 `table_path` 相同时,决定它们的匹配方式。 |
+| common options    | -              | 否    | -             | 转换插件的通用参数,参见 
[Transform Plugin](common-options/common-options.md)。 |
 
-### regex_pattern [string]
+:::info
 
-带有捕获组的正则表达式模式。捕获组的数量必须与输出字段的数量匹配。
+每条规则中都必须包含 `source_field`、`regex_pattern` 和 
`output_fields`。在多表配置中,可以省略转换级别规则,但每个 `table_transform` 
条目仍必须包含这三个选项。没有匹配条目的表将保持不变地传递下去。
 
-### output_fields [array]
+:::
 
-提取值的输出字段名称。大小必须与正则表达式模式中的捕获组数量匹配。
+### source_field [String]
 
-### default_values [array]
+需要提取数据的输入字段名称。匹配前会先通过 `toString()` 转换,因此其他类型的字段也可以使用。
 
-当正则表达式模式不匹配或源字段为 null 时,输出字段的默认值。如果提供,大小必须与输出字段数量匹配。
+该字段必须存在于输入表中,否则作业会因错误码 `TRANSFORM_COMMON-01` 失败:`The input field 'email' of 
'RegexExtract' transform not found in upstream schema`。
 
-### common options [string]
+### regex_pattern [String]
 
-转换插件的常见参数, 请参考  [Transform Plugin](common-options/common-options.md) 了解详情
+Java 正则表达式,使用 `java.util.regex.Pattern` 编译。它必须为 `output_fields` 
的每个条目包含一个捕获组:如果捕获组的数量与输出字段的数量不同,作业会在创建转换时失败。
 
-## 示例
+该模式通过 `Matcher#find` 应用,也就是说它会在值的任意位置搜索,不必匹配整个值,并使用第一个匹配结果。未参与匹配的捕获组会为其输出字段产生 
`null`。
 
-源端数据读取的表格如下:
+由于模式写在 HOCON 字符串中,反斜杠必须转义,例如 `regex_pattern = "([^@]+)@([^.]+)\\.(.+)"`。
 
-| id | email              | log_entry                                          
  |
-|----|--------------------|------------------------------------------------------|
-| 1  | [email protected]  | 2023-12-01 10:30:45 INFO User login successful     
  |
-| 2  | [email protected]     | 2023-12-01 11:15:22 ERROR Database connection 
failed |
-| 3  | [email protected]   | 2023-12-01 12:00:00 WARN Memory usage high         
  |
+### output_fields [Array&lt;String&gt;]
 
-我们想要从 `email` 字段中提取用户名、域名和顶级域名:
+转换生成的输出字段名称,按捕获组顺序排列:第一个输出字段接收捕获组 1,第二个接收捕获组 2,依此类推。列表不能为空。
+
+新的输出列会追加在已有输入列之后,原输入字段不会被删除。以这种方式追加的每个列都是可为空的 `STRING` 列,长度为 
200。如果某个输出字段名已存在于输入表中,该列会被复用并覆盖,而不是追加新列:提取出的值会替换该列的值,但该列会保留其原有的模式元数据——特别是,被复用的列不会自动变为可为空,也不会改变其长度。唯一可能改变的元数据是数据类型:如果该列的数据类型与
 `STRING` 不同,该列会被复制为 `STRING` 数据类型,同时保留其其他元数据。
+
+### default_values [Array&lt;String&gt;]
+
+每个输出字段的兜底值,顺序与 `output_fields` 相同。以下两种情况会使用默认值:
+
+- 源值为 `null`;
+- 源值与 `regex_pattern` 不匹配。
+
+设置 `default_values` 时,其长度必须与 `output_fields` 的长度相等,否则配置会被拒绝。未设置时,上述两种情况下输出字段均为 
`null`。
+
+### table_match_regex [String]
+
+与上游表路径匹配的正则表达式。转换级别规则(即 `table_transform` 之外的 
`source_field`、`regex_pattern`、`output_fields` 和 `default_values`)仅适用于匹配的表。默认值 
`.*` 匹配所有表。既不匹配该正则、也没有 `table_transform` 条目的表将保持不变地传递下去。
+
+注意,这里指的是真实的上游表名,而不是 `plugin_output`。
+
+### table_transform [Array&lt;Map&gt;]
+
+针对单表的规则列表。每个条目必须包含 `table_path`,其格式为 
`databaseName[.schemaName].tableName`(精确匹配),以及该表的一条完整 RegexExtract 规则,即 
`source_field`、`regex_pattern` 和 `output_fields`,需要时还可以包含 `default_values`。
+
+当某张表在 `table_transform` 中有条目时,转换级别规则不会应用于该表。参见 [多表配置](#多表配置)。
+
+### rule_match_mode [String]
+
+当多个 `table_transform` 条目具有相同的 `table_path` 时,决定如何处理。支持的值有 
`FIRST_MATCH`(仅应用第一个匹配的条目)和 `ALL_MATCH`(按顺序应用所有匹配的条目,后一个条目接收前一个条目的输出)。
+
+如果未设置 `rule_match_mode`,重复的 `table_path` 条目会被拒绝。当多个条目使用相同的 `table_path` 
时,请显式将其设置为 `FIRST_MATCH` 或 `ALL_MATCH`。
+
+### common options
+
+转换插件的常见参数,请参考 [Transform Plugin](common-options/common-options.md) 了解详情。
+
+## 多表配置
+
+当上游源输出多张表时(例如 JDBC 或 MySQL-CDC),一个 RegexExtract 转换可以处理所有这些表。
+
+- `table_transform` 中的条目优先于转换级别规则。有条目的表永远不会被转换级别规则处理。
+- 每个条目都必须是一条完整的单表规则(`table_path` 加上 `source_field`、`regex_pattern` 和 
`output_fields`)。
+- 转换级别规则仅适用于与 `table_match_regex` 匹配的表。
+- 当仅配置了 `table_transform` 时,没有条目的表保持不变。
+
+下面的配置为 `test.a.*` 表使用转换级别规则,为 `test.xyz` 使用单表规则,并让 `test.www` 保持不变:
+
+```hocon
+env {
+  parallelism = 1
+  job.mode = "BATCH"
+}
+
+source {
+  FakeSource {
+    plugin_output = "fake"
+    tables_configs = [
+      {
+        row.num = 2
+        schema = {
+          table = "test.abc"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.abcd"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.xyz"
+          fields { id = int, email = string }
+        }
+      },
+      {
+        row.num = 2
+        schema = {
+          table = "test.www"
+          fields { id = int, email = string }
+        }
+      }
+    ]
+  }
+}
 
-```
 transform {
   RegexExtract {
     plugin_input = "fake"
-    plugin_output = "regex_result"
+    plugin_output = "fake1"
+
+    table_match_regex = "test.a.*"
     source_field = "email"
     regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
-    output_fields = ["username", "domain", "tld"]
-    default_values = ["unknown", "unknown", "unknown"]
+    output_fields = [username, domain, tld]
+
+    table_transform = [
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+
+sink {
+  Console {
+    plugin_input = "fake1"
   }
 }
 ```
 
-那么结果表 `regex_result` 中的数据将会更新为:
+每张表的结果结构:
 
-| id | email              | log_entry                                          
  | username | domain  | tld |
-|----|--------------------|------------------------------------------------------|----------|---------|-----|
-| 1  | [email protected]  | 2023-12-01 10:30:45 INFO User login successful     
  | user1    | example | com |
-| 2  | [email protected]     | 2023-12-01 11:15:22 ERROR Database connection 
failed | admin    | test    | org |
-| 3  | [email protected]   | 2023-12-01 12:00:00 WARN Memory usage high         
  | guest    | domain  | net |
+| 表         | 应用的规则                              | 输出字段                        
   |
+|------------|-------------------------------------------|----------------------------------|
+| test.abc   | 转换级别规则(匹配 `test.a.*`) | id, email, username, domain, tld |
+| test.abcd  | 转换级别规则(匹配 `test.a.*`) | id, email, username, domain, tld |
+| test.xyz   | `table_transform` 条目                   | id, email, username, 
host        |
+| test.www   | 无                                      | id, email              
          |
 
-## 作业配置示例
+## 示例
 
-```
+### 单表
+
+源端数据读取的表格如下:
+
+| id | email             | log_entry                                           
 |
+|----|-------------------|------------------------------------------------------|
+| 1  | [email protected] | 2023-12-01 10:30:45 INFO User login successful      
 |
+| 2  | [email protected]    | 2023-12-01 11:15:22 ERROR Database connection 
failed |
+| 3  | [email protected]  | 2023-12-01 12:00:00 WARN Memory usage high          
 |
+
+我们想要从 `email` 字段中提取用户名、域名和顶级域名:
+
+```hocon
 env {
   job.mode = "BATCH"
 }
@@ -121,5 +245,92 @@ sink {
 }
 ```
 
+那么结果表 `regex_result` 中的数据将会更新为:
+
+| id | email             | log_entry                                           
 | username | domain  | tld |
+|----|-------------------|------------------------------------------------------|----------|---------|-----|
+| 1  | [email protected] | 2023-12-01 10:30:45 INFO User login successful      
 | user1    | example | com |
+| 2  | [email protected]    | 2023-12-01 11:15:22 ERROR Database connection 
failed | admin    | test    | org |
+| 3  | [email protected]  | 2023-12-01 12:00:00 WARN Memory usage high          
 | guest    | domain  | net |
+
+对于 `email` 与模式不匹配或为 `null` 的行,由于这里配置了 `default_values`,三个输出字段都会得到 
`unknown`。如果没有配置 `default_values`,这类行的三个输出字段都将是 `null`。
+
+### 多表
+
+`env`、`source` 和 `sink` 部分与 [多表配置](#多表配置) 中相同,仅 `transform` 部分不同。假设源输出 
`test.abc`、`test.abcd`、`test.xyz` 和 `test.www` 四张表,每张表都包含 `id` 和 `email` 字段。
+
+**1. 仅转换级别规则。** 由于 `table_match_regex` 默认为 `.*`,该规则适用于所有表。
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    source_field = "email"
+    regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+    output_fields = [username, domain, tld]
+  }
+}
+```
+
+**2. 转换级别规则加单表规则。** 完整的作业配置参见 [多表配置](#多表配置)。
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    table_match_regex = "test.a.*"
+    source_field = "email"
+    regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+    output_fields = [username, domain, tld]
+    table_transform = [
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+```
+
+**3. 仅单表规则。** 可以省略转换级别规则;没有条目的表将保持不变地传递下去。
+
+```hocon
+transform {
+  RegexExtract {
+    plugin_input = "fake"
+    plugin_output = "fake1"
+    table_transform = [
+      {
+        table_path = "test.abc"
+        source_field = "email"
+        regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+        output_fields = [username, domain, tld]
+      },
+      {
+        table_path = "test.abcd"
+        source_field = "email"
+        regex_pattern = "([^@]+)@([^.]+)\\.(.+)"
+        output_fields = [username, domain, tld]
+      },
+      {
+        table_path = "test.xyz"
+        source_field = "email"
+        regex_pattern = "([^@]+)@(.+)"
+        output_fields = [username, host]
+      }
+    ]
+  }
+}
+```
+
+`test.www` 没有匹配的条目,将保持不变地传递下去。
+
 ## 更新日志
 
+### 新版本
+
+- 添加 RegexExtract Transform 插件

Reply via email to