云日志服务 LTS-正则表达式函数:regex_match

时间:2025-03-03 16:33:03

regex_match

判断是否匹配正则表达式。

  • 函数格式
    regex_match(value, r"regular expression", full=false)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意

    要匹配的值。

    regular expression

    String

    正则表达式。

    full

    Bool

    是否完全匹配,默认为false。

  • 返回结果

    返回true或者false。

  • 函数示例

    判断字段str是否包含数字。

    • 测试数据
      {
        "str": "iZbp1a65x3r1vhpe94fi2qZ"
      }
    • 加工规则
      # 判断字段str是否包含数字。
      e_set("regex_match", regex_match(v("str"),r"\d+"))
      # 判断字段str是否全部为数字。
      e_set("regex_match2", regex_match(v("str"),r"\d+",full=true))
    • 加工结果
      str: iZbp1a65x3r1vhpe94fi2qZ 
      regex_match:  true
      regex_match2:  false
support.huaweicloud.com/usermanual-lts/lts_07_0153.html