Regex between enter

Hi all,
How to fetch the code that is between enter ?
I’ve tried like this, but when run on UiPath no output.
image

please help me fix the regex to get the output i want.

Logic uses given information to create an inference. For example, if you came home and found your 
leftovers were gone from
the fridge and you lived with a roommate. logic
142/CKP-DFU/C/2023
would dictate your roommate ate your food based on the fact no one else should be in the house.

HI,

Can you try \r?\n instead of \n, as the following?

(?<=a roommate. logic\r?\n).*?(?=\r?\n)

Regards,

Hi @Mulya_Habibi_Tullah1

Another approach

Regex.Match(yourStringVar, "\b\d{3}/[A-Z]{3}-[A-Z]{3}/[A-Z]/\d{4}\b").Value

Hi @Mulya_Habibi_Tullah1 ,

Please check this below code and pass your regex & input string to this code,
yourValue(String as type) = System.Text.RegularExpressions.Regex.Match("Your Input String","Your Regex", System.Text.RegularExpressions.RegexOptions.Multiline).Value

Let us know if this works for you?

Message Box: Object reference not set to an instance of an object.
haven’t got any results if run on UiPath

Hi,

What activity do you use? The following works in my environment.

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=a roommate. logic\r?\n).*?(?=\r?\n)").Value

Regards,

yes it works,

but this is just one example,
what i want is to take the sentence or code after the new line

Another example

image

These examples have been automatically selected and may contain sensitive content 
not reflect the opinions or policies of Collin
Or its parent company HarperCollins.
We welcome feedback: report an example sentence to the Collins team.

thanks @Yoichi , its woks

1 Like

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