Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 删除文本并仅显示部分答案_Regex_Google Sheets_Google Sheets Formula_Array Formulas - Fatal编程技术网

Regex 删除文本并仅显示部分答案

Regex 删除文本并仅显示部分答案,regex,google-sheets,google-sheets-formula,array-formulas,Regex,Google Sheets,Google Sheets Formula,Array Formulas,我试图运行一个索引匹配,返回一些文本,但我不想要全文,只想要集合中变化的部分。例如,单元格A1将包含 [I want to better understand what you did during this visit] During this visit, did the you... (select appropriate answer) [Receive a tour] A2 你会如何提取它,只是说 A1 A2 Receive a tour Meet w

我试图运行一个索引匹配,返回一些文本,但我不想要全文,只想要集合中变化的部分。例如,单元格A1将包含

[I want to better understand what you did during this visit] During this visit, did the you... (select appropriate answer) [Receive a tour]
A2

你会如何提取它,只是说

A1               A2
Receive a tour   Meet with the manager
文本可能变化很大,有时会有第二组方括号,有时不会。但谷歌表单数据中的一个一致性是,最后一对方括号是包含不同答案的部分。我只想得到这篇文章

…最后一对方括号是包含不同答案的部分。我只想得到这段文字

试试这个:

=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A1:A, "([^\[]*)\]$")))

或者更直截了当地说:

=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A1:A, "\s\[(.*)\]$")))

=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A1:A, "\s\[(.*)\]$")))