Extract data between two values

Hi, i am trying to extract text between two given values. For example:
“Hello my name is Molly
and i am trying to extract
data between this whole
paragraph”

I want to get everything in between ‘Molly’ and ‘paragraph’

I am using the Matches activity, creating a before label and an after label. This is returning a null value and throwing an error. It works with anything on a single line, but doesn’t seem to work with multiple lines.

@aksh1yadav

Hey @mollyblomer

Hope you are fine :slight_smile:

You can use below regex - (?:Molly((?:.?\r?\n?))paragraph)+

and then capture the First group to get what you are looking for :slight_smile:

Reference link - regex101: build, test, and debug regex

Regards…!!
Aksh

Hi @aksh1yadav thank you for your quick reply.

This is not working. I have two variables: labelBefore for the label ‘Molly’ and labelAfter for the label ‘paragraph’. How would I implement this into this regex?

Hey @mollyblomer

Refer this attached Sample :slight_smile: - Extract Text Between Labels.xaml (8.1 KB)

Regards…!!
Aksh