#44 _expandlinks without "www."

open
nobody
None
5
2005-03-21
2005-03-21
Matt Terenzio
No

Using version 1.2,

I do:

$snoopy->_expandlinks($links, http://domain.com\);
and I got:

http:/domain.com/links //notice missing slash

But:
$snoopy->_expandlinks($links, http://www.domain.com\); //added
www

works fine.

I think the regex should be:

function _expandlinks($links,$URI)
{

preg_match("/^[^\?]+/",$URI,$match);

THIS: $match = preg_replace("|/[^\/\.]*\.[^\/
\.]+$|","",$match[0]);

INSTEAD of :

$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);

I replace the + before the . with * and it seems to be working for me.

Discussion

  • Matt Terenzio
    Matt Terenzio
    2005-03-21

    Logged In: YES
    user_id=1243624

    UPDATE:

    I apologize. My test was flawed. That is not the solution above. The probel
    still exists.

     
  • Logged In: NO

    I think, solution is the next

    $match =
    preg_replace("|[^/]/[^\/\.]*\.[^\/\.]+$|","",$match[0]);