正则表达式匹配模式并将其打印到下一行

时间:2015-06-01 22:06:40

标签: regex notepad++

我有一个文本文件,数据用'|'分隔。示例数据如下所示:

584|Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface|N2TM      |01/28/2015|01.00.00|PM  |01/28/2015|02.00.00|PM  |IN|Y|NULL|N2TM      ||https://rti-events3.webex.com/rti-events3/onstage/g.php?MTID=ef4a250ead6cb06bad08d8e9ca3cb07ba|Daily support calls during the first week of GPRO Web Interface submission period.
Topic:  Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface 
Date:   Wednesday, January 28, 2015
Time:   1:00 pm -2:00 pm ET
You may join the event online or by phone. Please use only 1 of the 2 options shown below.
Option 1: To join the online event
1. Click on the link provided above.
2. Click "Join Now."
Option 2: To join the event by telephone only
US TOLL: 1-650-479-3207
Access code: 993 566 829
Event password: gpro128|2015-02-03-13.21.30.421193|2015-02-03-16.55.46.580524
585|Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface|N2TM      |01/29/2015|01.00.00|PM  |01/29/2015|02.00.00|PM  |IN|Y|NULL|N2TM      ||https://rti-events3.webex.com/rti-events3/onstage/g.php?MTID=e4c555479a1fc58ba3064b28983cd6595|Daily support calls during the first week of GPRO Web Interface submission period.
Topic:  Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface 
Date:   Thursday, January 29, 2015
Time:   1:00 pm - 2:00 pm ET
You may join the event online or by phone. Please use only 1 of the 2 options shown below.
Option 1: To join the online event
1. Click on the link provided above.
2. Click "Join Now."
Option 2: To join the event by telephone only
US TOLL: 1-650-479-3207
Access code: 991 837 559
Event password: gpro129|2015-02-03-13.26.46.870448|2015-02-03-13.27.03.a

我希望结果是:

584|Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface|N2TM      |01/28/2015|01.00.00|PM  |01/28/2015|02.00.00|PM  |IN|Y|NULL|N2TM      ||https://rti-events3.webex.com/rti-events3/onstage/g.php?MTID=ef4a250ead6cb06bad08d8e9ca3cb07ba|Daily support calls during the first week of GPRO Web Interface submission period.|Topic:  Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface |Date:   Wednesday, January 28, 2015|Time:   1:00 pm -2:00 pm ET|You may join the event online or by phone. Please use only 1 of the 2 options shown below.|Option 1: To join the online event|1. Click on the link provided above.|2. Click "Join Now."|Option 2: To join the event by telephone only|US TOLL: 1-650-479-3207|Access code: 993 566 829|Event password: gpro128|2015-02-03-13.21.30.421193|2015-02-03-16.55.46.580524
585|Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface|N2TM      |01/29/2015|01.00.00|PM  |01/29/2015|02.00.00|PM  |IN|Y|NULL|N2TM      ||https://rti-events3.webex.com/rti-events3/onstage/g.php?MTID=e4c555479a1fc58ba3064b28983cd6595|Daily support calls during the first week of GPRO Web Interface submission period.|Topic:  Daily Support Calls - PQRS Group Practice and ACO GPRO Web Interface |Date:   Thursday, January 29, 2015|Time:   1:00 pm - 2:00 pm ET|You may join the event online or by phone. Please use only 1 of the 2 options shown below.|Option 1: To join the online event|1. Click on the link provided above.|2. Click "Join Now."|Option 2: To join the event by telephone only|US TOLL: 1-650-479-3207|Access code: 991 837 559|Event password: gpro129|2015-02-03-13.26.46.870448|2015-02-03-13.27.03.a

基本上一些字段出现在新行中。我想把它们放在一行。

1 个答案:

答案 0 :(得分:1)

您可以使用此模式/替换:

search: \R(?!\d+\|)
replace: |

细节:

\R是任何类型换行序列的别名(包括\r\r\n\n

(?!...)是一个负面的预测。测试意味着"没有跟随"

\d+一个或多个数字

\|一个文字|