Hi
I have many text files with lots of text.
- I want to extract all the lines starting with the variable
\n\s{3}[A-Z]{2}\d{4}.[A-Za-z]{3}
Basically something like the below
AB2003.Jan -097
CD2008.Jul -0.778
AR2009.Jan -0.123
- But sometimes, they might be similar text that is preceded by “Auto”. I don’t want those
Auto
GH2003.Jan -097
JL2008.Jul -0.778
HG2009.Jan -0.123
Variation 1:
AB2003.Jan -097
CD2008.Jul -0.778
AR2009.Jan -0.123Some other text
Auto
GH2003.Jan -097
JL2008.Jul -0.778
HG2009.Jan -0.123
line with “--------------------------------------------------------------------”
Some other text
Variation 2:
AB2003.Jan -097
CD2008.Jul -0.778
AR2009.Jan -0.123
line with “---------------------------------------------------------------------”Some other text
- So basically, I want to extract all the lines
AB2003.Jan -097
CD2008.Jul -0.778
AR2009.Jan -0.123
that is NOT preceded by the word “Auto”. After these lines, it can be either a
a) blank line or
b) -------------------------------------------------------------------
I tried this, but it doesn’t work:
(System.Text.RegularExpressions.Regex.Match(Text1,“(?!Auto.)\n\s{3}[A-Z]{2}\d{4}.([A-Za-z]{3}|\d{1})\s{3,}(.|\n).+((?=\n.--------------------------------------------------------------------)|(?=\n)|(?=Auto.))”).Value)