* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
> What exactly does this do:
> 

Your original expression:

  /< (?!p|br) [^>]* >/x

Find '<' not followed by 'p|br' until the first '>' we find.
  
  <p class="foo">   - matches
  <  >              - matches

Its a bit confusing as why the <p *> matches, perhaps the
documentation at http://php.net/pcre might explain it a little
more. 


>  /< (?<=p|br) [^>]+ >/x
> 

Find '<' until, if 'any charcaters' between, '>' and be sure that
'p|br' exist before 'any characters'


And perhaps a little more effecient than the one above:

  /< (?=p|br) [^>]+ >/x

Find '<', followed by 'p|br' until, if 'any characters' between,
'>'.


The last one probably is a better one since it will fail quickly
whereas look behinds are a bit expensive since it will have to
match < [^>]+ > before it considers the 'p|br'.


> It may work, I just want to understand what it's looking for.

HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to