Reply to Re: A (hopefully) simple regular expression question...

Your name:

Reply:


Posted by Justin Koivisto on 01/12/06 22:10

alexrussell101@gmail.com wrote:

[snip]

> Is there a way to use a regular expression to search for an open
> <fieldset> and close it?
> I'm pretty sure there is, but I'm not so good at those negative
> regexps, I get that you'd have to search the output HTML for <fieldset>
> followed by any string of characters and NOT </fieldset> and then if
> that matches, then add </fieldset> to the end. Although that also
> doesn't close the </div> although I'm not sure how it manages not to
> close that (well actually cut it out) itself.
>
> Hmm maybe I don't want to just close stuff at all... it might just be
> best to remove the quote altogether or something. Anyway, can anyone
> help? It's not a major problem, but it ruins my layout, and I like my
> layout.
>
> Well thanks to anyone who can help, and sorry I've rambled on. Just
> trying to give as much info as I can.

You can use all the negative look-aheads you want, but if you are just
using it with preg_match in an if statement, you may be able to get away
with something along these lines:

$pattern='`<fieldset>.*</fieldset>`isU';
if(preg_match($pattern,$str)){
// fieldset is closed
}else{
// fieldset set is *not* closed
}

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.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

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