• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: extract URL from general text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extract URL from general text


  • Subject: Re: extract URL from general text
  • From: "Enrique Terrazas" <email@hidden>
  • Date: Tue, 18 Mar 2008 13:47:13 -0700

I need to extract valid "http" URL's from general (non-html) text. I define what is valid as follows:

1. begins with "http:"
2. preceded by " "
3. followed by " "
4. containing only valid characters (or validly encoded characters) as per RFC1738


Anybody have a script handy that might work or can be adapted?

H.

If you are willing and able to install three perl modules (Mac::Pasteboard and URI::Find and URI::Find::Simple), this will give you a return delimited list of url's in a text block that is present on the clipboard:


set s to do shell script "perl -e 'use Mac::Pasteboard; use URI::Find::Simple qw( list_uris ); print join(chr(10), list_uris(pbpaste()));'"

You will have to strip out any potential URL's that begin with https://

Enrique Terrazas

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >extract URL from general text (From: Hudson Barton <email@hidden>)

  • Prev by Date: extract URL from general text
  • Next by Date: Re: InDesign CS2, XML, and graphics
  • Previous by thread: extract URL from general text
  • Next by thread: Re: extract URL from general text
  • Index(es):
    • Date
    • Thread