|
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
Navigation:
[Reply to this message]
|