Reply to Re: take text from a string

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация