How to find specific string using regex

Hi,

I want to extract data from the below URL where I need the highlighted value, please suggest what regular expression will work here to extract the highlighted values.

HI @BHARAT_NAGAR

Can you send the input as text file?

Regards
Gokul

Hi!

try this:

System.Text.RegularExpressions.RegEx.Match("YourInputString","(https?:\/\/.\S+(?=<)|(?<=> > )\S+)(?=<)")

Reference:

Output:

Regards,
NaNi

Hi @BHARAT_NAGAR

Here is the workflow

Sequence.xaml (13.4 KB)

Hope it will resolve your query

Regards
Gokul

Hi
I am getting correct output but writing is not happening in excel
When I am getting data write in add data row, at that time object reference is not set (null reference exception) this error is coming how to solve it.

image

URL is coming in variable but writing is not happening in excel

Your passing a null value in the Add Data row activity

Can you share the screenshot of your workflow @BHARAT_NAGAR

Here is the workflow

Sequence.xaml (16.2 KB)

Hope it will works

Regards
Gokul

image

Final_2nd_url variable write in the add data row
in this variable, i am getting the correct value
and the same variable write in add data row

I ma using this step , but it is not working.
again showing same error.

Have you tried the above regex?

Regards,
NaNi

yes, its working in Regax.
Thanks all

can you help me in null Reference Exception.

Could you please show us the error where you’re getting?

Regards,
NaNi

Try like this:

in Add data row: ArrayRow

{Column1,Column2,1st_URL+"\in"+2nd_URL.ToString,Column4}

Regards,
NaNi

image
But i am write this variable in add data row


i am using this Regax and get the URL in two parts.

image
after that merge the URL in one variable
Ex: Final_2nd_URL(variable)
and same varible write in add data row, but it is showing the error.

Hi @BHARAT_NAGAR

Here is the workflow

Sequence.xaml (19.5 KB)

Hope it will works

Regards
Gokul

Hi
I am using same things , but its not working
it is showing the same error.

Hi @BHARAT_NAGAR

This workflow in working for me based on requirement of your query

Once if you share the screenshot of your Workflow will help us to look into the issue.

Regards
Gokul

image
In this screenshot i am get this URL using this Regax

image

and this part is working fine and write to excel sheet correctly.