删除以特定字符开头和结尾的任何子字符串

Delete any substring that begins and ends with specific characters

我在 google 张中有这样的字符串:

A1

,information-technology#ICT / Computer

在 A2

,agriculture#Agriculture / Agro-Allied,ngo#NGO/Non-Profit,project-management#Project Management

我需要删除以 , 开头并以 # 结尾的所有内容,包括这两个字符

如果可能输出要像这样用逗号分隔

B1

ICT / Computer

B2

Agriculture / Agro-Allied, NGO/Non-Profit, Project Management

尝试:

=ARRAYFORMULA(REGEXREPLACE(TRIM(FLATTEN(QUERY(
 TRANSPOSE(IF(IFERROR(SPLIT(A1:A3, "#"))<>"", 
 REGEXREPLACE(SPLIT(REGEXREPLACE(A1:A3, "(#)", "♥"), 
 "♥"), "(,.+)", )&",", )),,9^9))), "^, |,$", ))