in reply to Searching for web sites
Also, if you wish to do it by hand, switching to a different delimeter on your regexes will help you avoid backslashitis. Further, if your URLs are not broken across lines (i.e., if they don't have embedded newline) or have spaces, your could try the following (untested) regex as a starting point for conversion:
The above regex assumes that, at minimum, you will have two groups to characters separated by a period after the http:// portion. The negated character classes should actually be replaced by classes that state allowable characters (and if you really want to be anal, I recall that the first allowable character in a domain is different from other allowable characters, but sometimes I get into regex overkill).$newline =~ s#(http://[^.]+\.[^.]+\S+)#<a href="$1">$1</a>#gi;
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just go the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: (Ovid) Re: Searching for web sites
by electronicMacks (Beadle) on Oct 25, 2000 at 03:53 UTC | |
by mirod (Canon) on Oct 25, 2000 at 15:39 UTC | |
by FouRPlaY (Monk) on Oct 25, 2000 at 20:47 UTC |