regex - 在多种条件下拆分谷歌表格中的文本

标签 regex google-sheets google-sheets-formula spreadsheet re2

我想在多个条件下拆分文本。

这里是 sheet

这是我要拆分的文本。

[{ name : Lot 230: Condition 1 Waterproof Protective Hard Case with Foam, Orange 9\ x 7\ x 4\ Watertight IP67 Dust Proof and Shock Proof TSA Approved Portable Carrier , item_id :8259332, bid_id :113235886, single_amount : 10.0 , amount : 10.0 , quantity :1, charges_amount : 1.3 , buyers_charge_id :361, tax_amount : 0.9 , tax_rate_id :161, total_amount : 12.2 , removed :null, removed_reason :null},{ name : Lot 253: Honeywell Home RTH9585WF1004 Wi-Fi Smart Color Thermostat, 7 Day Programmable, Touch Screen, Energy Star, Alexa Ready, Gray , item_id :8259353, bid_id :113236249, single_amount : 12.0 , amount : 12.0 , quantity :1, charges_amount : 1.56 , buyers_charge_id :361, tax_amount : 1.08 , tax_rate_id :161, total_amount : 14.64 , removed :null, removed_reason :null}]

文本可以包含许多产品的信息。如您所见,上面的文字包含有关 2 种产品的信息。我只想将两种产品的名称放在不同的列中。

第 1 列:

Lot 230: Condition 1 Waterproof Protective Hard Case with Foam, Orange 9\ x 7\ x 4\ Watertight IP67 Dust Proof and Shock Proof TSA Approved Portable Carrier

第二列:

Lot 253: Honeywell Home RTH9585WF1004 Wi-Fi Smart Color Thermostat, 7 Day Programmable, Touch Screen, Energy Star, Alexa Ready, Gray

最佳答案

尝试:

=ARRAYFORMULA(IFERROR(REGEXREPLACE(SPLIT(REGEXREPLACE(A3:A, 
 "^\[", ), "{ name : ", ), " , item_id.*$", )))

enter image description here

关于regex - 在多种条件下拆分谷歌表格中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72282327/

相关文章:

google-sheets - 谷歌表 : How to use arrayformula to copy data from one sheet to another?

Java - 分割字符串以获取十进制数

google-apps-script - 使用谷歌应用程序脚本保护单元格(使用动态按钮或命令)

javascript - 正则表达式匹配以 开头的字符串。 # 和正常的一样

google-apps-script - 何时使用 getActiveSpreadsheet?

javascript - Google Apps 脚本功能在我手动运行时执行,但在作为触发器运行时失败,引用错误代码 INTERNAL

xpath - Google Sheets importxml 中 XPath 中的多个索引

google-sheets - ImportRange "Result to large"- 如何导入我需要的所有数据?

php - 对于不匹配的值,使用 preg_match_all 获取空数组结果

html - 使用正则表达式解析 html - 使用捕获和 $1 参数