Home > programming, Techie > How to extract text from a hyperlink (remove anchor tags)

How to extract text from a hyperlink (remove anchor tags)

This php code snippet shows how to retrieve the text part of a hyperlink:

$a_hrf = "/<a>]*?href=[\"\']?([^\'\">]*)[\'\"]?[^>]*?>/";
$a_close ="/<\/a>/";
$hyper_link = '<a href="http://www.example.com">Great Site!</a>';
$text = preg_replace($a_hrf, '', $hyper_link);
$text = preg_replace($a_close, '', $text);
Advertisements
Categories: programming, Techie Tags: , , ,
  1. April 10, 2010 at 15:28

    Hello,

    Do you guys watch movies in theater or on internet? I use to rent DVD movies from Blockbuster.com. Recently I discovered that we can watch all new movies on internet on day, they are released. So why should I spend money on renting movies??? So, can you guys please tell me where I can watch latest movie Ca$h 2010 for free?? I have searched Youtube.com, Dailymotion.com, Megavideo.com but, Could not find a good working link. If you know any working link please share it with me.

    Thanks

  2. April 24, 2010 at 12:32

    Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.

  3. April 26, 2010 at 18:27

    There’s good info here. I did a search on Google, Keep up the good work mate!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: