|
Posted by BoneIdol on 11/16/07 11:10
On 14 Nov, 19:16, Tom <t...@to.com> wrote:
> 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 &
> >Test</a></li>
>
> >the code will return Title & Test
>
> You can use preg_replace() similar to this...
>
> <?php
>
> $string = '<li><a href="http://localhost/namesitos/index.php?pg=id=b8f">Title
> & 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/
If you're just wanting to strip all the html from input (and I mean
strip, not escape with entities) just use strip_tags(). I haven't used
it in a long time, but I seem to recall that it would leave the text
between tags unmolestred.
http://www.php.net/strip-tags
[Back to original message]
|