Regex String Delimiter with Couple Lines

Hello. I have a text like below:

Length
High.
_3
_3
_3
34
2150
40
1.6
11000
240CZ

I want to get text between _3_3_3 and 240CZ. Which is:

34
2150
40
1.6
11000

I know that last limiter will be (?=240CZ). But I don’t know how to limit first “_3_3_3” part because of new line condition.

(?<=I couldn’t find this part)([\S\s]*)(?=240CZ)

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(text,"(?<=_3\r?\n_3\r?\n_3\r?\n)[\s\S]*(?=240CZ)").Value

Regards,

1 Like

It didn’t work.

Hi,

Can you try the following sample?

Sample20201208-1.zip (2.2 KB)

If input string is not same as yours, can you share it?

Regards,

1 Like

I am trying your code here:

It it gives error.

Hi,

Because regex101 is not 100% compatible with .net regex.
The above pattern works in UiPath.

Regards,

1 Like

I am sorry, I was trying your code at that website. I checked it on UiPath and it works. Thank you so much.

1 Like

(?<=_3\s\n_3\s\n_3)[\s\S]*(?=240CZ)

If someone needs it, the code above also works for this condition.

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