Delete line with 3 or more same charaters?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

lalpha8sorter
Posts: 5
Joined: Sat Mar 10, 2012 5:44 am

Delete line with 3 or more same charaters?

Postby lalpha8sorter » Sat Mar 10, 2012 5:53 am

I have a list from which I need to remove lines which contains 3 or more of the same character anywhere within the line.

I have tried for hours using replace matching word pattern with the following but it just give me an error stating no lines to repeat.

What is most frustrating is more than likely really simple!

Thanks in advance.

lalpha8sorter
Posts: 5
Joined: Sat Mar 10, 2012 5:44 am

Re: Delete line with 3 or more same charaters?

Postby lalpha8sorter » Sat Mar 10, 2012 10:55 pm

I have read through http://www.datamystic.com/easypatterns_reference.html and still cannot understand it.

Can anyone help out with it please.

I just basically want to remove any line that has 3 or more of the same character!

Thank you

lalpha8sorter
Posts: 5
Joined: Sat Mar 10, 2012 5:44 am

Re: Delete line with 3 or more same charaters?

Postby lalpha8sorter » Sun Mar 11, 2012 12:24 am

I think I have come up with a solution to sort out lines up to 7 char long however does seem rather long winded.

I'm sure there must be an easier way to delete lines which contain 3 or more of the same character anywhere within the line?


(a)[b-z](a)[b-z](a)[b-z](a)
[b-z][b-z](a)[b-z](a)[b-z](a)
[b-z](a)[b-z][b-z](a)[b-z](a)
(a)[b-z][b-z][b-z](a)[b-z](a)
[b-z](a)[b-z](a)[b-z][b-z](a)
(a)[b-z][b-z](a)[b-z][b-z](a)
(a)[b-z](a)[b-z][b-z][b-z](a)
[b-z](a)[b-z](a)[b-z](a)[b-z]
(a)[b-z][b-z](a)[b-z](a)[b-z]
(a)[b-z](a)[b-z][b-z](a)[b-z]
(a)[b-z](a)[b-z](a)[b-z][b-z]

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete line with 3 or more same charaters?

Postby DataMystic Support » Tue Mar 13, 2012 8:59 am

Use a Remove\Matching lines filter, with an EasyPattern of

[ capture(letter), group1, group1 ]

'group1' refers to the text (ie the letter) already captured, so 3 or more duplicate letters will be removed by this.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

lalpha8sorter
Posts: 5
Joined: Sat Mar 10, 2012 5:44 am

Re: Delete line with 3 or more same charaters?

Postby lalpha8sorter » Wed Mar 14, 2012 6:51 pm

Thanks although That seems to work if the letters are next to each other, but not when on the same line in different columns.

I need a command to delete a line if it has more than three of the same character anywhere on the line, not just next to each.

for example asasasas ,would not be deleted by [ capture(letter), group1, group1 ]

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete line with 3 or more same charaters?

Postby DataMystic Support » Wed Mar 14, 2012 10:03 pm

Then use

Code: Select all

[ capture(letter), 0+ not cr or lf, group1, 0+ not cr or lf, group1 ]
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

lalpha8sorter
Posts: 5
Joined: Sat Mar 10, 2012 5:44 am

Re: Delete line with 3 or more same charaters?

Postby lalpha8sorter » Sat Mar 17, 2012 12:28 am

Excellent, that works thank you


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 1 guest