Posted by Thomas Mlynarczyk on 11/13/07 15:49
Also sprach artev:
> I would like to extract a piece of string inner oneother;
> how rule for extraction all text inner this ">.......</a>
> example if I have this string
> <li><a href="http://localhost/namesitos/index.php?pg=id=b8f">Title
> & Test</a></li>
> the code will return Title & Test
To get just the text inside an <a> element, you can try something like this
(untested):
preg_match( '°\<a\s+[^>]+\>(.*?)\</a\>°', $text, $matches )
$matches[1] will then contain the text.
But if you want to remove all HTML, have a look at PHP's strip_tags()
function.
Greetings,
Thomas
--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Back to original message]
|