Regex to get the output

Regex to get this output

Input

"We have
Page 1 abc

Data"

or

“We have
Page 1
Data”

or

"We have
Page 1

Data"

Here the page 1 is fixed and I need to extract the data which can be in next line or to the next 2 line
and another thing is that, there can be any word after the “page 1” we need to ignore all the text after that in that same line

Hi @Sweety_Girl
Check this

(?=Data).*

Thanks
Ashwin S

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(strData,"(?<=Page 1.*[\r\n]+)\S.*").Value

or

System.Text.RegularExpressions.Regex.Match(strData,"(?<=Page 1.*[\r\n]+)\S[\s\S]*").Value
(If the Data contains linebreak)

Regards,

Not working

Hi @Sweety_Girl
which expression you have given

Thanks
ashwin S

I have tried both

Hi,

I’ll attach sample for my previous expression as the following.
I’m glad if you could check it. And if it isn’t what you want to achieve, can you tell us point to correct?

Sample20200102.zip (12.9 KB)

Regards,

1 Like

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