Regex multiline selection

Hello all,

I’m able to select only single line, how to select multiple lines dynamically maybe till drill water as show in below example ?
image

Hi @Chethan_M1

Enable multiline in Flags

Regards

Or use this regex @Chethan_M1

(?<=Remarks\:)[\s\S]*?\(recovered.*

Regards

it’s not selecting
image

still need to select multiple lines
image

Hi @Chethan_M1

Can you please share the input text

Regards

Try this @Chethan_M1

(?<=Remarks\:\s+)[\s\S]*?\(recovered[\s\S]*

May be entire text will help me provide you regex @Chethan_M1

Hope it helps!!

Yes @Parvathy entire lines are getting selected, need to end the selection before Tubing Press S\S

image

Hi @Chethan_M1

Can you share this text. I will help you with regex

Try this @Chethan_M1

(?<=Remarks\:\s+)[\s\S]*?\(recovered[\s\S]*?(?=\s+Tubing Press L\/S)

Regards

can you share the input text

Sorry I can’t share as it’s company data

@tazunnisa.badavide Input it’s confidential

Hi @Chethan_M1

Share the screenshot of the data. I will help you.

Regards

Hello @Chethan_M1

Please try the syntax (?<=AfterThisWord)((.|\n)*?)(?=TillBeforeThisWord) if you want to extract texts between two words that are spanning across multiple lines using RegEx

For example: If you want extract texts between Remarks and Drill Water, replace AfterThisWord with Remarks and TillBeforeThisWord with Drill Water as shown below

image

Yep this works fine I just removed last expression to match exactly, @Parvathy Thank you so so much!!!

(?<=Remarks:\s+)[\s\S]?(recovered[\s\S]?(?=\s+Tubing Press L) can you brief me this expression please

what’s the diff b/w .* & *?

Hi @Chethan_M1

.*: This is a greedy quantifier. It matches any character (except for line terminators) zero or more times, as many times as possible. This means it will match as much as it can while still allowing the overall pattern to match. In other words, it will match the longest possible sequence of characters.
*?: This is a non-greedy quantifier. It matches any character (except for line terminators) zero or more times, but as few times as possible. This means it will match as little as possible while still allowing the overall pattern to match. In other words, it will match the shortest possible sequence of characters.

If you find the solution for the query, please mark my post as solution to close the loop or if you have any queries, I’m happy to help.

Regards

again able to match multi values in regexr but UiPath match activity throwing null


Hi @Chethan_M1

(?<=Remarks\:\s+)[\s\S]*?\(recovered[\s\S]*?(?=\s+Tubing Press L\/S)

You have missed the / before S. Check with that.

Regards

pattern: (?<=Remarks:\s+)[\s\S]*?((?=\s+Tubing Press L\S)|(?=\s+Tubing Press S\S))
this expression is working fine both in regexr as well UiPath match activity

Thank a lot @Parvathy for all your value time and efforts!..

Hi @Chethan_M1

Perfect. So, the topic can be closed. Please mark my post as solution to close the loop

Regards