0

I am massaging text files and converting them to CSV for upload into my DB. I have a particular text file with several thousand lines in it and I would like to eliminate every other line using a regular expression search and replace. Here is an example of the text:

6 Radiation Therapy <-- This is the line I want to keep and the white space is a tab character

Radiation therapy provided by a healthcare provider <-- This is the line I want to replace with "nothing" and there is no tab character.

I have tried numerous regular expressions looking for strings WITHOUT a tab character in them but I am not able to get a match. I either match everything or nothing. Here is the latest attempt: (.+[^\t].+)

Thanks for your help!

  • 1
    A string not containing a certain char, tab here: `^[^\t]*$`, see my answer at the linked thread, scroll to "*a string containing specific character*". – Wiktor Stribiżew Oct 08 '20 at 20:36
  • What exactly is `Radiation Therapy` ? Is it a constant literal you search for ? How does that relate to strings with no tabs ? –  Oct 08 '20 at 20:37
  • That worked. Thank you! – commodore64 Oct 08 '20 at 20:38
  • According to that linked _dup_ , `^(?!\t).*$` is supposed to work. Try that first. –  Oct 08 '20 at 20:50

0 Answers0