"mattslav" <matt.slavicek gmail.com> wrote:
>
>
>Ok, I replaced the square brackets with parens, and that
did the trick.
>I think that's all I need.
>
>I'm not sure what the difference is between a capturing
group and
>non-capturing group. Could you elaborate a little on
that?
capture groups/backreferences allow you to reference or
return only parts
of the expression -- which is where regex really becomes
useful in
find/replace routines. Typically, stuff in parenthesis is
captured into a
backreference -- so in (find)(this) find would be
backreference 1, and
this would be backreference 2. To keep from having to count
a bunch of
backreferences to get just 1 or 2 bits of data, you can use
parenthesis and
have them NOT capture a backreference -- to do so just use
(?:find)(this)
-- in that case, find would be part of the overall match but
not a
backreference. 'this' would be backreference 1.
Jan Goyvaerts has written an excellent guide to regular
expressions that
covers this topic much better than I can--
http://
regular-expressions.info/brackets.html
--
Remember, no matter where you go, there you are. -Buckaroo
Banzai
Online Regex find/repalce utility: http://rereplace.com
Command-based online image editor: http://theprawn.com/imag
iine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regex googlegroups.com
To unsubscribe from this group, send email to
regex-unsubscribe googlegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---
|