OK, I found a thread that help out from a while back (Oct 9, 2002) to
give me this pattern:
`(((f|ht)tp://)(([^@:]+)([^@]+)?@)?([^:\/])+(:\d+)?(\/[^\s]+)?)`i
OK, all is well and good with this until the URL is used at the end of a
sentance. I am assuming that I will need a negative lookahead somehow,
but I just can't wrap my mind around this one...
Want to match only the URL...
$string="... http://www.example.com .";
$string="... http://www.example.com/.";
$string="... http://www.example.com/page1.html?";
$string="... http://www.example.com/info.php?id=4!" ;
etc...
The pattern above is pulling the last character from each string when I
don't want it. Unfortunately, the URL can be _anything_ valid, and I
don't have control of how it will be input. Can anyone help with this?
TIA
--
Justin Koivisto - spam@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
SEO Competition League: http://seo.koivi.com/
give me this pattern:
`(((f|ht)tp://)(([^@:]+)([^@]+)?@)?([^:\/])+(:\d+)?(\/[^\s]+)?)`i
OK, all is well and good with this until the URL is used at the end of a
sentance. I am assuming that I will need a negative lookahead somehow,
but I just can't wrap my mind around this one...
Want to match only the URL...
$string="... http://www.example.com .";
$string="... http://www.example.com/.";
$string="... http://www.example.com/page1.html?";
$string="... http://www.example.com/info.php?id=4!" ;
etc...
The pattern above is pulling the last character from each string when I
don't want it. Unfortunately, the URL can be _anything_ valid, and I
don't have control of how it will be input. Can anyone help with this?
TIA
--
Justin Koivisto - spam@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
SEO Competition League: http://seo.koivi.com/
Comment