Reply to Re: selecting specific tag

Your name:

Reply:


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
==================

[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

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