Extracting specific string from text file

Hi,

I would like to extract only certain portion of the text file.
In this example, I would like to extract the details of key feature 1 to 4 thus basically from “Change description:” to “Key feature 4” using regex but its not retrieving any data. Please help!

E.g.
System.Text.RegularExpressions.Regex.Match(changeDetails,“(?<=Change description:)[\s\S]?(?=[\r\n]+.?:)”).Value.Replace(“”“”,“”).Replace(“-”,“”).Trim

extractThis.txt (398 Bytes)

Hi,

Hope the following helps you.

System.Text.RegularExpressions.Regex.Match(strData,"(?<=Change description:\r\n)[\s\S]*?(?=\r\n\r\n)").Value

If you need “Change description:” in the output string, the following will work.

System.Text.RegularExpressions.Regex.Match(strData,"Change description:[\s\S]*?(?=\r\n\r\n)").Value

Regards,

It worked! Thank you so much! :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.