Extract URL from text

Hi All,

I am looking for a dynamic regex code which can extract all URL’s which starts with HTTP OR HTTPS.

Below is the sample paragraph for reference.

While browsing the internet, a user might start their day by visiting a secure site like https://example.com
to read news, then jump to an older blog hosted at http://blog.example.org
for archived content, or even type www.sample.net
directly into the browser out of habit. Developers sometimes access resources from ftp://ftp.example.com/files when downloading datasets, while businesses encourage communication through links such as mailto:info@example.com or quick contact options like tel:+1234567890. On a local machine, someone may open a document using file:///C:/Users/Public/readme.txt, experiment with embedded content using data:text/plain,HelloWorld, test applications via http://127.0.0.1:8080
, or manage settings through a local dashboard at http://localhost/admin

Hi @darshit.patel ,

You can try this regex as it works for me

https?:\/\/[^\s]*

Refer below screenshot

1 Like

Hi @darshit.patel

Welcome to Community

You can try this

\bhttps?://[^\s,)]}]+

If this solution help you please mark as Solved

Thanks & Happy Automations

Hi Nishi,

Tried using your code but it shows error. Kindly check below SS.

Thanks,
Darshit Patel

@darshit.patel

Try this

\bhttps?://[^\s,)]}]+

Let me know if you face any error

Thanks

Hi @Maheep_Tiwari,

This works fine, Thankyou so much.

To extract only URLs that start with http or https, you can use the following regex: https?:\/\/[^\s"'>]+. This pattern matches both http:// and https:// links and correctly captures domains, IP addresses


Also ignoring other protocols like ftp, mailto, file, tel, data, or plain www links.

1 Like

Hi,

How about the following sample? This pattern is arranged from pre-build URL pattern in FindmatchingPattern activity.

(?i)(?:https?:\/\/)(?:\([-a-zA-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-a-zA-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-a-zA-Z0-9+&@#\/%=~_|$?!:,.]*\)|[a-zA-Z0-9+&@#\/%=~_|$])

Sample
Sample20251222-1.zip (4.3 KB)

Regards,

1 Like

Hi Nishi,

The code you provided now is same as earlier one. Anyways I found the Solution.

Thanks and regards,
Darshit Patel

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