Posted by Tommy Gildseth on 06/21/06 19:51
lazypig06@gmail.com wrote:
>
> --------------------------------------------------------------
> Junk dataflasjfasj
> <firsttag>
> <secondtag>data</secondtag>
> <thirdtag>whatever</thirdtag>
> </firsttag>
>
> junk dataga.
> ---------------------------------------------------------------
>
> Does someone know how to remove the junk in the file and just return
> the actual xml stuff( including the <firsttag> tag ?
I believe this should work:
<?php
$str = 'Junk dataflasjfasj
<firsttag>
<secondtag>data</secondtag>
<thirdtag>whatever</thirdtag>
</firsttag>
junk dataga.
';
echo preg_replace('/.*?<(.*)>.*/s', '<$1>', $str);
?>
--
Tommy Gildseth
http://design.twobarks.com/
Navigation:
[Reply to this message]
|