How to remove links from file

Discussion in 'PHP' started by deriklogov, Nov 4, 2009.

  1. #1
    Hey,

    I need your help , can you suggest how to remove html links from text.
    Like I got some text and some parts contain link like <a href=""> and so on, some of them very different, how to remove them ?
     
    deriklogov, Nov 4, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you wanting to remove just the tags?
    $out = preg_replace('%<a\b[^>]+>(.*?)</a>%si', '$1', $input);
    PHP:
     
    JAY6390, Nov 4, 2009 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    so u just want the link removed the text stays rite ??
     
    Bohra, Nov 4, 2009 IP
  4. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,080
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Yes, I just need to remove links , text stays and other tags stays too
     
    deriklogov, Nov 4, 2009 IP