Regex find(正则查找(Regex find))¶
Supported in: Batch, Faster, Streaming
Matches an expression against a regular expression. Regular expression can match any part of the string.
Expression categories: Regex, String
Declared arguments¶
- Expression: The expression to match against the regular expression.
Expression\ - Regex: The regular expression to find.
Expression\
Output type: Boolean
Examples¶
Example 1: Base case¶
Description: The pattern must be in the string but does not have to match the full value.
Argument values:
- Expression: abcdefg
- Regex: abc
Output: true
Example 2: Base case¶
Description: You can find regex patterns.
Argument values:
- Expression: abcdefg
- Regex: abc?d
Output: true
Example 3: Base case¶
Description: Regex patterns sometimes don't match input strings.
Argument values:
- Expression: abdefg
- Regex: ab?d
Output: true
Example 4: Null case¶
Description: Can match using back tracking.
Argument values:
- Expression: hello hello
- Regex: (hello) \1
Output: true
Example 5: Null case¶
Description: Can match using lookahead.
Argument values:
- Expression: helloworld
- Regex: (\w+)(?=world)
Output: true
Example 6: Null case¶
Description: Null pattern do not match.
Argument values:
- Expression: foo
- Regex: null
Output: false
Example 7: Null case¶
Description: Null columns do not match.
Argument values:
- Expression: null
- Regex: ab?d.*
Output: false
Example 8: Null case¶
Argument values:
- Expression:
foo - Regex:
pattern
| foo | pattern | Output |
|---|---|---|
| foo | ( | false |
| foo | null | false |
| null | foo | false |
| null | null | false |
中文翻译¶
正则查找(Regex find)¶
支持:批量(Batch)、快速(Faster)、流式(Streaming)
将表达式与正则表达式进行匹配。正则表达式可以匹配字符串中的任意部分。
表达式类别: 正则(Regex)、字符串(String)
声明的参数¶
- 表达式(Expression): 要与正则表达式匹配的表达式。
表达式\<字符串> - 正则表达式(Regex): 要查找的正则表达式。
表达式\<字符串>
输出类型: 布尔值(Boolean)
示例¶
示例 1:基础情况¶
描述: 模式必须存在于字符串中,但无需匹配整个值。
参数值:
- 表达式: abcdefg
- 正则表达式: abc
输出: true
示例 2:基础情况¶
描述: 可以查找正则模式。
参数值:
- 表达式: abcdefg
- 正则表达式: abc?d
输出: true
示例 3:基础情况¶
描述: 正则模式有时无法匹配输入字符串。
参数值:
- 表达式: abdefg
- 正则表达式: ab?d
输出: true
示例 4:空值情况¶
描述: 可以使用回溯进行匹配。
参数值:
- 表达式: hello hello
- 正则表达式: (hello) \1
输出: true
示例 5:空值情况¶
描述: 可以使用前瞻进行匹配。
参数值:
- 表达式: helloworld
- 正则表达式: (\w+)(?=world)
输出: true
示例 6:空值情况¶
描述: 空模式无法匹配。
参数值:
- 表达式: foo
- 正则表达式: null
输出: false
示例 7:空值情况¶
描述: 空列无法匹配。
参数值:
- 表达式: null
- 正则表达式: ab?d.*
输出: false
示例 8:空值情况¶
参数值:
- 表达式:
foo - 正则表达式:
pattern
| foo | pattern | 输出 |
|---|---|---|
| foo | ( | false |
| foo | null | false |
| null | foo | false |
| null | null | false |