Sample : Stripping URLs from a file or string

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Sample : Stripping URLs from a file or string

Post by Dorian (MJT support) » Fri Nov 02, 2012 12:48 am

I thought this might help a few people here. I posted it in response to another thread in the water cooler, but figure people who need it will be looking here instead.

Extracting URLs using regex :

Code: Select all

//sample text
let>text=rfuhroiurnfifnroi http://www.fish.com fuh3ifuh34ifurf http://www.chips.com

// it seems pattern looks for http://, not www. so we'll add in the http://
stringreplace>text,www,http://www,text

// Find URLS
RegEx>[Hyperlink],text,1,matches,num,0

// write it all to a file
Let>k=0
Repeat>k
Let>k=k+1
WriteLn>%USERDOCUMENTS_DIR%\url output.txt,result,matches_%k%
Until>k,num

Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts