On 20 Nov 98, at 8:29, Luana Howard wrote:
> Hello, folks,
> A while back, there was a discussion on parsing bodies of text to find
> URL's, then inserting the proper anchor tag so that the address is turned
> into a working link on the fly. Can anyone shed some light on how this is
> done? I'm guessing I'll need to use =~ in there somewhere...
A valid URL should start with http:// and end with a space...
If you haven't a so well formatted text file (eg. many people forget
the http when they wrote down URL) you can look for
alphabetical+other valid URL char followed by a point and then
followed again by a valid URL char (eg. a.b) then you'll search the
first space on the left and the first space on the right the string
between these 2 space could be an URL... but just COULD be...
The later method is not secure. it depends on how well your
original file was formatted...
Currently I can't figure out if there are other kind of string in a
"reasonable" file that contain substring like xxx.yyy.zzz that aren't
URL.
Keep attention also to string like .xxx.yyy.zzz or (more probable at
the end of a sentence) xxx.yyy.zzz. (the last point is a valid URL
char but i think xxx.yyy.zzz. is not a valid URL).
Of course what I wrote is heavily dependent on the definition of
"reasonable".
Maybe your list of URLs is comma delimited so you'll have to
search for http:// and ,
etc...
Since I argued you'll use Perl I can't be of further help sorry...
I've started to learn languages in alphabetical order: Assembly,
Basic, C++, Delphi, Fortran... my list finishes at Pascal... :-)
-------------------------------------------
Ivan Sergio Borgonovo [EMAIL PROTECTED]
Webmaster Gorilla Bookstore http://www.gorilla.it
Tel. +39 2 3311105/34530455 Fax. +39 2 34531591
Via Mac Mahon 9, Milano, Italy
-------------------------------------------
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------