Regex for locating a line with two non-consecutive tab characters
glossar last edited by glossar
I need a regex that will locate lines which contains two non-consecutive tab characters. By non-consecutive I mean, there are two, or maybe more, tab characters anywhere in a line. I can’t locate the relevant line on Notepad++, only when I paste the whole text on a Excel sheet I find out that at least one line contains more than one tabs.
entry [tab] some text [tab] more text
Thanks in advance!
Alan Kilborn last edited by Alan Kilborn
That one’s fairly easy. What have you tried to accomplish it?
Note: We usually give one “freebie” data conversion, and you got that one already. After that, we demand from posters that they try first and present what didn’t work or “kinda worked” in order to receive additional help. Basically, we’re not a data-search or data-conversion service.
EDIT: Actually, you’ve gotten several “freebies” in your posting history. Lucky you. :-)
Terry R last edited by
I need a regex that will locate lines which contains two non-consecutive tab characters.
As @Alan-Kilborn says, we aren’t a free bus service. We do like to help people but also prefer the people asking to try to further their own education a little, learn by our solutions. Of course the kicker is that most times we will give you a one shot answer, often a complicated regex which going forward you will have a hard time deciphering.
So… a bit of guidance here rather than the actual solution:
One method (using several steps) would be to change the first tab on every line to a special character (or possibly 2 characters, so say
@@). Then using a 2nd regex remove ALL tabs. Then the 3rd regex would be to reinsert the first tab by replacing the
@@with a tab.
PeterJones last edited by
glossar last edited by glossar
Isn’t this the same question you asked last year?
Because there were good answers there, which you thought worked. And if the situation has changed, you could start with one of those, and try to modify it yourself.
@PeterJones Ah, exactly the same! I forgot I had asked it before. I couldn’t find (any of ) the rexeges you built there among the ones I saved for future use, maybe I saved but didn’t name it, and at some point deleted it, I don’t remember. Anyway, many thanks for locating it. :)) I appericate it.
@Alan-Kilborn and @Terry-R
I understand you. I, too, do ask askers to try first what they ask. But I’m also a giver in other areas on other platforms. As you might have noticed the last time I asked for help here was April 2019 - roughly one and half years ago. I don’t demand an asker try themselves first who ask for help couple of times every couple of years or learn to speak that language of that beautiful girl, which he doesn’t speak and with whom he fell in love, only to text her a couple of times. :P Anyway, I got your point and I’ll consider it in the future when asking new ones.
Terry R last edited by Terry R
I understand you. I, too, do ask askers to try first what they ask.
I’m sorry if what we said has offended you. But I will reiterate my previous post. We aren’t a free bus service hop on and hop off at will.
That said, I did offer up a solution for you. All you need to do is convert that into some regexes. My steps are such that these should be easy to code up for someone just learning regex. And if you were to do that and still miss getting what you wanted then show us what you had done. We’d be glad to guide you some more.
From our point of view if we gave everyone the solutions they want without asking for something in return we’d be inundated with requests. It’s much like the proverb:
“if you give a hungry man a fish, you feed him for a day, but if you teach him how to fish, you feed him for a lifetime”. My guidance is an attempt at teaching you how to “fish”.