我需要提取沒有標題的文本行,直到行 ,,,,,Total
輸入
Sr.No ,Description of Goods ,HSN ,,City ,Unit ,,Unit Price ,Amount (in BP)
1 ,29550762R3C0-Top- ST22E360 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
2 ,29550762R3C0-Bot- ST22E361 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
3 ,2945486609-G2 - Bot Stencil - ST22F199 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
4 ,2945457600-S1 - Top Stencil - ST22F224 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
5 ,2945457600-G2 - Bot Stencil - ST22F225 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
,,,,,Total ,,,25000.00 IN
,,,,,Discount ,,,0.00 3
,,,,Total Amount ,Before Tax ,,,"? 25,000.00 "
,,,,,IGST 0% ,,,? 0.00
,,,,Total Amount ,After Tax: ,,,"? 25,000.00 "
預期輸出
1 ,29550762R3C0-Top- ST22E360 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
2 ,29550762R3C0-Bot- ST22E361 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
3 ,2945486609-G2 - Bot Stencil - ST22F199 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
4 ,2945457600-S1 - Top Stencil - ST22F224 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
5 ,2945457600-G2 - Bot Stencil - ST22F225 ,84439990 ,,1.00 ,Numbers ,,5000.00 ,5000.00
我嘗試過:=REGEXEXTRACT(A10,"(\n.*)"),行數事先不知道,并且可能因單元格而異。有的可能有 1 個,有的有 5 到 6 個。
uj5u.com熱心網友回復:
僅使用您顯示的示例,請嘗試以下解決方案。這是顯示的正則運算式的
中的公式A3:
=QUERY(FLATTEN(SPLIT(A1,CHAR(10))),"where Col1 matches '^\d. '")
uj5u.com熱心網友回復:
我會簡單地匹配以數字、空格、逗號開頭的行直到行尾:
/^\d *,.*$/gm
Regex101.com 上的演示
^ Start of line
\d One or more digits
* Zero or more spaces
, Comma
.* Any character
$ End of line
/gm Flags: Global; Multi line
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/504964.html
上一篇:過濾太慢
下一篇:谷歌表格查詢回傳一行中的所有行
