Grab hyperlink irrespective of location in mail

Hi,
I would receive an email that should have a hyperlink with certain invoice no i am supposed to click.
To ignore other emails and only select that email- i used isMatch activity- https://regex101.com/r/aGOKLl/23
Now from this email I want to filter out the href link for the text searched above
When i use- https://regex101.com/r/aGOKLl/24 it works fine
But i would like a way to grab the link just before the client word i have used in the ismatch activity above.

I would appreciate an easier way to do this.
Any help is appreciated!

Hi @Anu14,

Use the below regex,

(?:https://).*?\(?=(.+)Client_Invoice_20190131003911)

Where the value is hardcoded that value you will be passing dynamically.by extracitng the invoice number first and passing to above regex.

Ismatch activity returns a boolean value, to get the value import system.text.regularexpressions and use Regex.match(Inputstring,“Pattern”).tostring

Thank you @anil5 for replying
I used the above expression- https://regex101.com/r/aGOKLl/26
It is now exluding the first https that outlook appends.
Could you please take a look?

(?:https://).*?(?=(.+)(?=Client_Invoice_20190131003911)

On the right side, match information click on full match and use the above expression

@Anu14

Use pattern as
(?<=href[=\"]+).*?(?=([">\r\n]+Client_Invoice_))
This will match only the URL in the href and even works when client invoice number changes

Use this

(?<=href=")(.+?)(?=">\nClient)

Use the above expression.
or
the below expression

(?<=href=")(.+?)(?=\W+\n+Client)

thank you Madhavi.
The text changed a bit but yes something similar worked.
Thanks!

1 Like

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