Regex: Extract text on newline

Hi

I want to extract “IDENTIFIABLE CLIMATE CHANGE PRESENT”.

COMBINED TEST FOR THE PRESENCE OF CLIMATE CHANGE
IDENTIFIABLE CLIMATE CHANGE PRESENT

Tried

Nextline =
System.Text.RegularExpressions.Regex.Match(Text1,"(?<=COMBINED TEST
FOR THE PRESENCE OF CLIMATE CHANGE)(\n).+").Value`

But I only get a blank for Nextline. Thank you

If there is no text after that you can maybe use something like this:

CHANGE\n(.*)

And select group 1.

If there is text after last PRESENT word, you can use something like this:
(?<=COMBINED TEST FOR THE PRESENCE OF CLIMATE CHANGE).(\n.)+(?=random)

HI
We can get this with a single expression
Stroutput = strinput.ToString.Split(Environment.NewLine.ToArray())(2).ToString

Here I have mentioned 2 because it’s in third line
If it’s in second line mention as 1

As the index position usually starts from 0

Cheers @Anonymous2

if you results exactly same as below

"COMBINED TEST FOR THE PRESENCE OF CLIMATE CHANGE - 0 line
IDENTIFIABLE CLIMATE CHANGE PRESENT - 1 line

try the split option -

strinput.Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)(1)

1 Like