On Tue, Jan 30, 2007 at 03:21:47PM -0700, Google Kreme wrote:

> I think it is the (?:(? part of it that really scrambles my brain.   
> the !</?td> makes sense to me.
> 
> >(?:(?!</?td).)* means check that the next thing in the string isn't  
> ></?td, then match one character, then check again, and so on.
> 
> Nicely explained.  What's the ':' doing there, just a separator?

() are capturing parentheses.  At some point in the development of Perl, it
was decided that there should also be non-capturing parentheses.  (?) was
not legal syntax, because you can't have a left parenthesis followed by a
quantifier.  So it was decided to use (?:) for non-capturing parentheses.
Other uses of (?) were added as well, such as (?s) to turn on single-line
mode, (?i) for case-insensitivity, and so on.

Then someone came up with the idea for positive and negative lookaheads:
(?=) and (?!) respectively.  Then we got positive and negative lookbehinds:
(?<=) and (?<!); postponed subexpressions: (?{}); the cut operator: (?>);
et al.  And PCRE adds even more (?) syntax that's not yet legal in Perl.

So, any time you see (?, it's some special regex syntax, along with the
next character or characters in the regex.

Ronald

-- 
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to