|
Posted by Thomas Mlynarczyk on 11/13/07 21:02
Also sprach artev:
>> preg_match( '°\<a\s+[^>]+\>(.*?)\</a\>°', $text, $matches )
>> $matches[1] will then contain the text.
> work, thanks;
> so this is the code for to extract from a link the text?
This is one way to do it. Note, that, if the link contains other HTML
elements (like a <span>, for example), those will be returned as part of the
text. Also, the above code only returns the text from the first link it
finds. If you have several links and need the text from all of them, have a
look at preg_match_all().
> is a standard code or you have make for yourself ?
It is a regular expression that I made up to show you a way to a possible
solution. Depending on your exact requirements, you might need to do some
modifications on that code.
Greetings,
Thomas
--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Back to original message]
|