Get string between two characters c#

Hello All,

I am using this code to extract string between two topics…

text.str = dataText.ToString.Substring(dataText.IndexOf(“heading1”) + “heading1”.Length, dataText.IndexOf(“heading2”) - dataText.IndexOf(“heading1”) + “”.Length)

but i am getting extra text in the bottom …so can any one help me out this…

Thanks,
Suresh.

1 Like

Hi @suresh_kumar4

Try this regex to get the text between two text.

regexPattern = (?<=Heading 1)(.*\n)+(?=Heading 2)

I’m attaching the workflow for your reference. ExtractStringBetweenTwoStrings.zip (14.0 KB)

1 Like

Hi @suresh_kumar4

You can use this article for your reference. :smiley:

cheers :smiley:

Happy learning :smiley:

1 Like

@suresh_kumar4,

Check this workflow, it may help you extract string between two strings.
StringBetween2Words.xaml (8.2 KB)

1 Like

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