文件读取内容字符串格式化

data = 订单号,不能超过15位,订单号一样代表一张票qq283117523发票类型qq283117523购货单位名称qq283117523购货单位纳税人识别号qq283117523购货单位地址电话qq283117523购货单位开户行和银行账号qq283117523货物或应税劳务名称qq283117523税收分类编码(19位)qq283117523规格型号qq283117523单位qq283117523数量qq283117523单价qq283117523含税标志qq283117523金额qq283117523税率qq283117523税额qq283117523收款人qq283117523复核人qq283117523开票人qq283117523备注qq283117523

1qq283117523专用发票qq283117523南京福加自动化科技有限公司qq283117523913201137681532158qq283117523南京市栖霞区龙潭街道工业园 122 025-85238797qq283117523招商银行迈皋桥支行 253680791910001qq283117523谐波滤波器qq2831175231090232070000000000qq283117523HFR005X4SA037N35-37/70Aqq283117523台qq2831175231qq283117523qq283117523含税qq2831175234399.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523qq283117523
2qq283117523专用发票qq283117523大同嘉诚同兴科技有限公司qq28311752391140200MA0HJ9K32Mqq283117523山西省大同市城区魏都大道东侧锦祥小区3号商住楼1单元11层1103号
0352-2028567qq283117523华夏银行股份有限公司大同分行 11763000000941633qq283117523输入电抗器qq2831175231090404040000000000qq283117523ACR-0030-0M47-0.4SCqq283117523台qq2831175235qq283117523qq283117523含税qq2831175231800.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523qq283117523
3qq283117523专用发票qq283117523大同嘉诚同兴科技有限公司qq28311752391140200MA0HJ9K32Mqq283117523山西省大同市城区魏都大道东侧锦祥小区3号商住楼1单元11层1103号
0352-2028567qq283117523华夏银行股份有限公司大同分行 11763000000941633qq283117523输入电抗器qq2831175231090404040000000000qq283117523ACR-0030-0M47-0.4SCqq283117523台qq28311752315qq283117523qq283117523含税qq2831175235400.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523qq283117523
4qq283117523专用发票qq283117523大同嘉诚同兴科技有限公司qq28311752391140200MA0HJ9K32Mqq283117523山西省大同市城区魏都大道东侧锦祥小区3号商住楼1单元11层1103号
0352-2028567qq283117523华夏银行股份有限公司大同分行 11763000000941633qq283117523输入电抗器qq2831175231090404040000000000qq283117523ACR-0030-0M47-0.4SCqq283117523台qq28311752315qq283117523qq283117523含税qq2831175235340.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523qq283117523
5qq283117523专用发票qq283117523思源清能电气电子有限公司qq28311752391310112672677110Bqq283117523上海市闵行区华宁路3399号 021-61610684qq283117523中国银行上海市闵行支行 450761409043qq283117523铝壳电阻qq2831175231090519020000000000qq283117523RXLG-200W-20RJ-2051qq283117523台qq2831175232qq283117523qq283117523含税qq28311752366.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523POORD117578/21346/14913/15912qq283117523
6qq283117523专用发票qq283117523思源清能电气电子有限公司qq28311752391310112672677110Bqq283117523上海市闵行区华宁路3399号 021-61610684qq283117523中国银行上海市闵行支行 450761409043qq283117523铝壳电阻qq2831175231090519020000000000qq283117523RXLG-200W-20RJ-2051qq283117523台qq2831175238qq283117523qq283117523含税qq283117523264.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523POORD117578/21346/14913/15912qq283117523
7qq283117523专用发票qq283117523思源清能电气电子有限公司qq28311752391310112672677110Bqq283117523上海市闵行区华宁路3399号 021-61610684qq283117523中国银行上海市闵行支行 450761409043qq283117523不锈钢电阻qq2831175231090519020000000000qq283117523SRA-100A-0.03RK-3-2051qq283117523台qq2831175234qq283117523qq283117523含税qq2831175231680.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523POORD117578/21346/14913/15912qq283117523
8qq283117523专用发票qq283117523思源清能电气电子有限公司qq28311752391310112672677110Bqq283117523上海市闵行区华宁路3399号 021-61610684qq283117523中国银行上海市闵行支行 450761409043qq283117523高压电阻qq2831175231090519020000000000qq283117523RXHG-35kV-100kJ-1.2kRJ-2051Wqq283117523台qq28311752327qq283117523qq283117523含税qq28311752345900.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523POORD117578/21346/14913/15912qq283117523
9qq283117523专用发票qq283117523思源清能电气电子有限公司qq28311752391310112672677110Bqq283117523上海市闵行区华宁路3399号 021-61610684qq283117523中国银行上海市闵行支行 450761409043qq283117523高压电阻qq2831175231090519020000000000qq283117523RXHG-35kV-100kJ-1.2kRJ-2051Wqq283117523台qq28311752333qq283117523qq283117523含税qq28311752356100.00qq2831175230.13qq283117523qq283117523贾婷婷qq283117523王云霞qq283117523李磊qq283117523POORD117578/21346/14913/15912qq283117523

var content = eval('`' + data + '`');
console.log(content);
//以(非
qq283117523\n开头的换行都替换掉
var contentOne = content.replace(/[^(qq283117523)]\n/g,'') 
console.log(contentOne);
var lines = contentOne.split("\n");

 

posted @ 2022-07-11 11:35  LaLaLa_heng  阅读(26)  评论(0编辑  收藏  举报