跳转至

Regex match(正则表达式匹配(Regex match))

Supported in: Batch, Faster, Streaming

Matches an expression against a regular expression. Regular expression must match the whole string.

Expression categories: Regex, String

Declared arguments

  • Expression: The expression to match against the regular expression.
    Expression\
  • Regex: The regular expression to match against.
    Expression\

Output type: Boolean

Examples

Example 1: Base case

Description: Regex must match the entire string

Argument values:

  • Expression: (
  • Regex: abc

Output: false


Example 2: Base case

Description: Regex must match the entire string

Argument values:

  • Expression: abcdefg
  • Regex: abc

Output: false


Example 3: Base case

Description: You can match regex patterns

Argument values:

  • Expression: abcdefg
  • Regex: abc?d.+

Output: true


Example 4: Base case

Description: Regex patterns sometimes don't match input strings

Argument values:

  • Expression: abdefg
  • Regex: ab?d.*

Output: true


Example 5: Null case

Description: Null pattern do not match

Argument values:

  • Expression: foo
  • Regex: null

Output: false


Example 6: Null case

Description: Null columns do not match

Argument values:

  • Expression: null
  • Regex: ab?d.*

Output: false


Example 7: Null case

Argument values:

  • Expression: foo
  • Regex: pattern
foo pattern Output
foo ( false
foo null false
null foo false
null null false


中文翻译


正则表达式匹配(Regex match)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

将表达式与正则表达式进行匹配。正则表达式必须匹配整个字符串。

表达式类别: 正则表达式(Regex)、字符串(String)

声明的参数

  • 表达式(Expression): 要与正则表达式进行匹配的表达式。
    表达式\
  • 正则表达式(Regex): 用于匹配的正则表达式。
    表达式\

输出类型: 布尔值(Boolean)

示例

示例 1:基础情况

描述: 正则表达式必须匹配整个字符串

参数值:

  • 表达式: (
  • 正则表达式: abc

输出: false


示例 2:基础情况

描述: 正则表达式必须匹配整个字符串

参数值:

  • 表达式: abcdefg
  • 正则表达式: abc

输出: false


示例 3:基础情况

描述: 可以匹配正则表达式模式

参数值:

  • 表达式: abcdefg
  • 正则表达式: abc?d.+

输出: true


示例 4:基础情况

描述: 正则表达式模式有时无法匹配输入字符串

参数值:

  • 表达式: abdefg
  • 正则表达式: ab?d.*

输出: true


示例 5:空值情况

描述: 空模式不匹配

参数值:

  • 表达式: foo
  • 正则表达式: null

输出: false


示例 6:空值情况

描述: 空列不匹配

参数值:

  • 表达式: null
  • 正则表达式: ab?d.*

输出: false


示例 7:空值情况

参数值:

  • 表达式: foo
  • 正则表达式: pattern
foo pattern 输出
foo ( false
foo null false
null foo false
null null false