SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Text Matching

  1. #1
    SitePoint Zealot imagize's Avatar
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text Matching

    Im developing a script and i want when i parse bb codes etc, i also want to make text in the format

    http://www.*.*
    www.*.*

    etc, automatically become links to themselves.

  2. #2
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i made something that accepts http:// and www.

    $link2="www.yahoo.com this is a link";
    $htmllink2=ereg_replace("(http:[/][/]www|www)[^<>[:space:]]+[[:alnum:]/]",
    "<a href=\"\\0\">\\0</a>", $link2);

    $link3="http://www.yahoo.com this is a link";
    $htmllink3=ereg_replace("(http:[/][/]www|www)[^<>[:space:]]+[[:alnum:]/]",
    "<a href=\"\\0\">\\0</a>", $link3);

    echo $htmllink2;
    echo "<br>";
    echo $htmllink3;

    it seems to work, no guarantees what else itll match lol so use it at ur own risk.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •