![Notepad++ 和正则表达式:从行列表中提取字符串和两个数字](https://linux22.com/image/1522134/Notepad%2B%2B%20%E5%92%8C%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%EF%BC%9A%E4%BB%8E%E8%A1%8C%E5%88%97%E8%A1%A8%E4%B8%AD%E6%8F%90%E5%8F%96%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%92%8C%E4%B8%A4%E4%B8%AA%E6%95%B0%E5%AD%97.png)
我有一个包含如下行的大型数据列表:
672629,Maros,Maros,Marisus|Mures|Muresh|Muresul|Mureş|Mureşul|mwrysh,46.25,20.2,H,STM,HU,HU|RO,00,0,81,Europe/Budapest,2009-04-06
677528,Gémesi Révház,Gemesi Revhaz,46.33472,18.89167,P,PPL,HU,00,0,102,Europe/Budapest,2014-07-08
680145,Fekete-Körös,Fekete-Koros,Black Koros|Black Körös|Crisu Negru|Crisul Negru|Crişu Negru|Crişul Negru|Fekete-Koros|Fekete-Körös|Raul Crisu Negru|Râul Crişu Negru,46.7,21.26667,H,STM,HU,00,0,88,Europe/Budapest,2012-01-18
680147,Fehér-Körös,Feher-Koros,Crisu Alb|Crisul Alb|Crişu Alb|Crişul Alb|Feher-Koros|Fehér-Körös|Weifse Koros|Weifse Körös|Weisze Koros|Weisze Körös|White Koros|White Körös,46.93333,20.96667,H,STM,HU,00,0,80,Europe/Budapest,2012-01-18
680300,Kraszna-csatorna,Kraszna-csatorna,Canalul Crasna|Canalul Crasnei|Kraszna-csatorna,48.13333,22.31667,H,CNL,HU,00,0,112,Europe/Budapest,2014-07-08
680311,Kraszna,Kraszna,Crasna|Krasna|Kraszna,48.15,22.33333,H,STM,HU,00,0,108,Europe/Budapest,2014-07-08
713827,Mogyorós,Mogyoros,Moggorospuszta|Moggoróspuszta|Mogyoros|Mogyorospuszta|Mogyorós|Mogyoróspuszta,47.03333,21.56667,L,AREA,HU,HU,10,0,93,Europe/Budapest,2012-01-18
713828,Zvaradűlő,Zvaradulo,46.85,20.78333,P,PPL,HU,03,0,81,Europe/Budapest,2007-08-27
713829,Zuhogó,Zuhogo,Nagyzuhogo|Nagyzuhogó|Zuhogo|Zuhogó,47.85,22.56667,L,AREA,HU,HU,18,0,111,Europe/Budapest,2012-01-18
713830,Zúgó-tető,Zugo-teto,48.03333,20.8,T,HLL,HU,04,0,136,Europe/Budapest,1993-12-28
713831,Zugoly,Zugoly,Szugoly|Zugoly,46.2,20.45,P,PPLX,HU,HU,06,0,79,Europe/Budapest,2012-01-18
713832,Zúgó-dűlő,Zugo-dulo,47.58333,21.9,L,AREA,HU,10,0,144,Europe/Budapest,2007-08-27
713833,Zuglókert,Zuglokert,47.31667,20.93333,P,PPL,HU,20,0,85,Europe/Budapest,1993-12-28
713834,Zug-kert,Zug-kert,47.33333,20.9,L,AREA,HU,20,0,86,Europe/Budapest,1993-12-28
713835,Zubogyi Tanya,Zubogyi Tanya,48.38333,20.58333,P,PPL,HU,04,0,243,Europe/Budapest,1993-12-28
713836,Zubogy,Zubogy,Zubogy,48.38333,20.58333,P,PPL,HU,04,0,243,Europe/Budapest,2012-01-18
713837,Zubogó-tető,Zubogo-teto,48.33333,20.68333,T,HLL,HU,04,0,267,Europe/Budapest,1993-12-28
713838,Zubogórész,Zubogoresz,47.55,22.03333,P,PPL,HU,10,0,138,Europe/Budapest,1993-12-28
713839,Zsurk,Zsurk,Zsurk,48.41184,22.21955,P,PPL,HU,18,0,103,Europe/Budapest,2012-01-18
713840,Zsujta Vasúti Megállóhely,Zsujta Vasuti Megallohely,48.5,21.26667,S,RSTP,HU,04,0,155,Europe/Budapest,1993-12-28
713841,Zsujta,Zsujta,Zsujta,48.5,21.28333,P,PPL,HU,04,0,188,Europe/Budapest,2012-01-18
713842,Zsórytanya,Zsorytanya,47.78333,21,P,PPL,HU,04,0,92,Europe/Budapest,1993-12-28
713843,Zsombokos,Zsombokos,47.01667,21.5,P,PPLX,HU,10,0,86,Europe/Budapest,1993-12-28
713844,Zsombódűlő,Zsombodulo,46.31667,20,P,PPL,HU,06,0,85,Europe/Budapest,2007-08-27
713845,Zsombékosdűlő,Zsombekosdulo,Zsombekos|Zsombékos,47.2,20.01667,P,PPLX,HU,HU,16,0,88,Europe/Budapest,2007-08-27
713846,Zsombékakol,Zsombekakol,Zsombekakol|Zsombokakol|Zsombékakol|Zsombókakol,47.15,20.98333,P,PPLX,HU,HU,03,0,82,Europe/Budapest,2012-01-18
713847,Zsoldosdűlő,Zsoldosdulo,47.45,21.4,P,PPLX,HU,10,0,96,Europe/Budapest,2007-08-27
713848,Zsoldos,Zsoldos,47.15,21.45,P,PPLL,HU,10,0,88,Europe/Budapest,1993-12-28
713849,Zsolcai-halom,Zsolcai-halom,48.11667,20.88333,T,HLL,HU,04,0,125,Europe/Budapest,1993-12-28
713850,Zsófiatanya,Zsofiatanya,47.98333,20.93333,P,PPL,HU,04,0,97,Europe/Budapest,1993-12-28
713851,Zsófiamajor,Zsofiamajor,46.93333,20.91667,P,PPL,HU,03,0,82,Europe/Budapest,1993-12-28
713852,Zsőcetanya,Zsocetanya,48.18333,21.83333,P,PPL,HU,18,0,92,Europe/Budapest,1993-12-28
713853,Zsírostanya,Zsirostanya,47.85,22.56667,P,PPLX,HU,18,0,111,Europe/Budapest,1993-12-28
我想得到第 2 列,加上通常在第 4 列和第 5 列的两个数字
所以它们就变成这样了:
Maros 46.25 20.2
Gémesi Révház 46.33472 18.89167
.
.
.
我们可以用正则表达式实现这个吗?
答案1
找什么:^\d+,\s*([^,]+)+[^0-9]+([0-9\.]+),\s*([0-9\.]+),.+$
用。。。来代替:\1,\2,\3