Page 1 of 1

find tabs or lack there of

Posted: Sat Dec 03, 2011 11:13 am
by jazzastronomer
Hi
Sorry for the newbie question, I'm not a programmer.

I'm looking at a flashcard file. It is a tab delimited file, with tabs separating the fields on each line.

I'd like a couple of regex please.

1) bookmark every line where number of tabs is 0. There is no tabs on a line

2) bookmark every line where number of tabs is 1. There is exactly one tab on a line.

3) bookmark every line where number of tabs is greater then one. That is 2 or more tabs on a line.

thanks

Posted: Sat Dec 03, 2011 11:58 am
by jazzastronomer
this

search for [^\t+]
replace with nothing

Is what I'm using now but it just shows a list of all of the tabs. I'm working with a big file and would like to bookmark lines instead.

Posted: Sat Dec 03, 2011 12:06 pm
by ak47wong
Click Search > Find.

1) To bookmark every line where the number of tabs is 0:

Find what: ^[^\t]*$

2) To bookmark every line where the number of tabs is 1:

Find what: ^[^\t]*\t[^\t]*$

3) To bookmark every line where the number of tabs is greater than 1:

Find what: [^\t]*\t[^\t]*\t[^\t]*

Click Mark All.

Posted: Sat Dec 03, 2011 12:28 pm
by jazzastronomer
thanks AK47WONG

works fine. Thanks very much!

I'm guessing there is no option to visualize spaces in the Find what: search input box? Those invisible, but match changing spaces are really annoying.

thanks again
coho

Posted: Sat Dec 03, 2011 12:33 pm
by ak47wong
Unfortunately not. I sometimes find it useful to compose the search expression in TextPad itself (or even Notepad) and then copy and paste it to the Find dialog.