in reply to Regex to find URLs in a string
BTW, it checks to see if the URL is at the end of a sentence and therefore might have an extra period.sub urlcheck($newline) { $newline =~ s/http\:\/\//\<a href \= \"http\:\/\//ig; if (substr ($newline, $#newline - 1, 1) eq ".") { $x = substr ($newline, /\G/, $#newline - 1); } else { $x = substr ($newline, /\G/); } $page = $x; $page =~ s/(http\:\/\/)|(\<\/a\>)|\=|\"|(href)|(\<a)|(\w+[ ]+)//g; $newline =~ s/$x/$x\"\>$page\<\/a\>/; return $newline; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Regex to find URLs in a string
by merlyn (Sage) on Oct 25, 2000 at 03:46 UTC | |
by FouRPlaY (Monk) on Oct 25, 2000 at 20:55 UTC | |
|
RE: RE: Regex to find URLs in a string
by mdillon (Priest) on Oct 25, 2000 at 21:57 UTC | |
by FouRPlaY (Monk) on Oct 25, 2000 at 22:01 UTC |