【问题标题】:using regex group in dataweave mule在 dataweave mule 中使用正则表达式组
【发布时间】:2018-05-16 11:19:26
【问题描述】:

如何使用正则表达式组从 dataweave 1.0 中的字符串中提取数据?

%var sampleString="3,2,0"

{
"groups":using(regexMatch= sampleString scan /^(?<grp1>\d{1}),(?<grp2>\d{1}),(?<grp3>\d{1})$/) {
        "group1": regexMatch["grp1"] ????? Any way to get the grp1 value by group name,
        "group2": regexMatch[0][2] //works,
        "group3": regexMatch[0][3] //works
    }
}

【问题讨论】:

    标签: mule dataweave


    【解决方案1】:

    不幸的是,scan 函数返回的是数组数组 (doco),而不是地图数组,因此查询它的唯一方法是通过数字索引。命名的捕获组最终被视为任何其他组(即名称被忽略)。

    【讨论】:

      猜你喜欢
      • 2017-03-06
      • 2020-04-04
      • 2021-10-16
      • 2020-09-14
      • 2011-01-26
      • 2023-03-22
      • 2022-12-06
      • 2017-01-18
      相关资源
      最近更新 更多