Reply to Re: extract a part of string from other string

Your name:

Reply:


Posted by Tom on 11/14/07 19:16

On Tue, 13 Nov 2007 16:34:18 +0100, artev wrote...
>
>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 &amp;
>Test</a></li>
>
>the code will return Title &amp; Test



You can use preg_replace() similar to this...

<?php

$string = '<li><a href="http://localhost/namesitos/index.php?pg=id=b8f">Title
&amp; Test</a></li>' ;

echo preg_replace('/<li><a href\=.+>(.+)<\/a>\<\/li>/', "$1", $string);

?>


Tom
--
NewsGuy Free Trial Accounts
Now a massive 20 Gigabytes of unrestricted downloads !
http://newsguy.com/

[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

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