|
Posted by Jerry Stuckle on 04/04/06 02:01
Stephen Kay wrote:
> in article e0rdf6$gk2$1@info.science.uva.nl, Y.G. at
> yg_blah_@this_domain.bla wrote on 4/3/06 11:03 AM:
>
>
>>preg_replace(
>>
>>>>'#^(.*)(<div class="foo">.*</div>)#isU',
>>>>'$2$1',
>>>>$content
>>>>);
>
>
>
> OK, I'm stupid, but how do you find and replace the BODY tag with
> preg_replace?
>
> Here's an example:
>
> <BODY TEXT="#99FFFF" BGCOLOR="#000000" LINK="#ff99ff" VLINK="#ff99ff"
> ALINK="#d3d3d3">
>
>
> So I want to find "<BODY " and everything up to the next ">", and replace it
> with "<!-- Body tag was here -->" (for example).
>
> I have not figured out this preg syntax yet. :-(
>
You need to be careful - you can't just replace to the next ">", i.e. (on three
lines for the heck of it)
<body TEXT="#99FFFF"
<!-- BG color was black -->
BGCOLOR="#0000FF">
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|