Delete entire rows

A place to try and solve your RegEx problems.
Post Reply
Torsten
Posts: 5
Joined: Mon Mar 02, 2015 7:54 am

Delete entire rows

Post by Torsten »

Hello,
at first, sorry for my bad english. But I try it anyway. I want to search for a word and delete the entire row in which it occurs. So far I have used it with another program and used this command: " ^.*,XX.*\R " (XX indicates that searching word). But this does not work with TextCrawler because "\R" is not recognized. Is there another way?

Thank you in advance, Torsten
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Delete entire rows

Post by DigitalVolcano »

This works (lower case r):

Code: Select all

^.*,XX.*\r
You need the 'multi line anchors' option checked as well.
Torsten
Posts: 5
Joined: Mon Mar 02, 2015 7:54 am

Re: Delete entire rows

Post by Torsten »

Ok, thank you for the quick reply, I will try it.

Torsten
Torsten
Posts: 5
Joined: Mon Mar 02, 2015 7:54 am

Re: Delete entire rows

Post by Torsten »

In regular expression tester it works very well. "^.*,XX.*\r\n" brings the correct result (,XX indicates that searching word). But not in the main window. Here is the message: No matches found. In both cases, I have the same settings. Is this a bug or what could I have done wrong?

Torsten
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Delete entire rows

Post by DigitalVolcano »

Does your file not have CR/LF line endings? That could cause no matches with that expression. You can swap the \r\n for $ to indicate any line ending - then it will work on all files.
Also make sure that 'Multi line anchors' is checked.
Torsten
Posts: 5
Joined: Mon Mar 02, 2015 7:54 am

Re: Delete entire rows

Post by Torsten »

Here are three lines as an example:

S50ARX,S5,EU,3525.5,80m,PA4N,PA,EU,CQ,30,2012-08-25 00:00:00,25,CW
G0PZA,G,EU,3525.5,80m,PA4N,PA,EU,CQ,16,2012-08-25 00:00:01,25,BPSK
VE2WU,VE,NA,14019.3,20m,YO2BBX,YO,EU,CQ,25,2012-08-25 00:00:01,19,CW

Each line with ",CW" should be deleted. With "$" does not work. The lines are indeed empty, but still present. The line must be properly deleted, including any spaces.
Thanks for the help.

Torsten
Torsten
Posts: 5
Joined: Mon Mar 02, 2015 7:54 am

Re: Delete entire rows

Post by Torsten »

I've got it. With "^.*,CW.*\n" it worked. How can I delete the last empty line?

Torsten
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Delete entire rows

Post by DigitalVolcano »

(\n|$) maybe? That will match end of line or end of file.
Post Reply