【问题标题】:Spreadsheet formula to extract regex groups用于提取正则表达式组的电子表格公式
【发布时间】:2021-08-11 13:36:29
【问题描述】:

我正在尝试将这个R_A_E_M_YT_Keywords_A_47 变成这个R_A_E_Keywords

我的电子表格公式中缺少什么?

=REGEXREPLACE(Input!I28:I,"([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)", "$1_$2_$3_$6")

【问题讨论】:

    标签: regex google-sheets google-sheets-formula grouping


    【解决方案1】:

    _47 离开那里是因为你没有替换它。

    =REGEXREPLACE(Input!I28:I,"([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+)_([A-Za-z]+).*$", "$1_$2_$3_$6")

    【讨论】:

      【解决方案2】:

      另一种方法:

      =join("_", query(split(A2, "_"), "Select Col1, Col2, Col3, Col6", 0))
      

      【讨论】:

        猜你喜欢
        • 2014-02-07
        • 1970-01-01
        • 1970-01-01
        • 2011-01-16
        • 1970-01-01
        • 2023-03-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多