正则表达式从列表中提取所有组作为 arrayformula
regexextract all groups from list as arrayformula
我正在寻找能够从列表中提取所有可能组的正则表达式数组公式。这是一个可视化:
到目前为止我试过:
=ArrayFormula(REGEXEXTRACT(A2:A6, "["&TEXTJOIN("|", 1, A8:A)&"]"))
=ArrayFormula(REGEXEXTRACT(A2:A6, "[("&TEXTJOIN("|", 1, A8:A)&")]"))
=ArrayFormula(REGEXEXTRACT(A2:A5, "["&TEXTJOIN("|", 1, "("&A8:A&")")&"]"))
...
也许只是开箱即用,但如果您在 B2
:
中尝试过会怎么样
=ARRAYFORMULA(IFERROR(TRANSPOSE(FILTER(A:A,ISNUMBER(SEARCH(SUBSTITUTE(A:A," ","*"),A2)))),""))
你可以在 B2 中像这样伪造它:
=INDEX(IF(REGEXMATCH(A2:A5,
TRANSPOSE(SUBSTITUTE(A8:A10, " ", ".*"))), TRANSPOSE(A8:A10), ))
我正在寻找能够从列表中提取所有可能组的正则表达式数组公式。这是一个可视化:
到目前为止我试过:
=ArrayFormula(REGEXEXTRACT(A2:A6, "["&TEXTJOIN("|", 1, A8:A)&"]"))
=ArrayFormula(REGEXEXTRACT(A2:A6, "[("&TEXTJOIN("|", 1, A8:A)&")]"))
=ArrayFormula(REGEXEXTRACT(A2:A5, "["&TEXTJOIN("|", 1, "("&A8:A&")")&"]"))
...
也许只是开箱即用,但如果您在 B2
:
=ARRAYFORMULA(IFERROR(TRANSPOSE(FILTER(A:A,ISNUMBER(SEARCH(SUBSTITUTE(A:A," ","*"),A2)))),""))
你可以在 B2 中像这样伪造它:
=INDEX(IF(REGEXMATCH(A2:A5,
TRANSPOSE(SUBSTITUTE(A8:A10, " ", ".*"))), TRANSPOSE(A8:A10), ))