Closed GoogleCodeExporter closed 9 years ago
A recursive expression is really just a special case of a repeated expression
where the expression repeats itself either directly or indirectly. Although
issue 27 is titled "Recursive patterns", it's really more general than that:
it's repeated expressions.
As for \K, the webpage says: """The key difference between \K and a lookbehind
is that a lookbehind does not allow you to use quantifiers: the length of what
you look for must be fixed.""". The regex module supports variable-length
lookbehinds, so \K, which is really just a workaround, isn't needed.
Original comment by re...@mrabarnett.plus.com
on 7 Jul 2012 at 11:52
> The pattern definitions (DEFINE)... also don't look that useful, as the
repeated named expressions work very similarly.
If you are looking for the examples of (?(DEFINE)) then the following url might
be useful for you.
http://perl5.git.perl.org/perl.git/blob/HEAD:/t/re/reg_email.t
Original comment by msm...@gmail.com
on 8 Jul 2012 at 4:40
Thanks for the confirmation; it's really a useful feature, which I certainly
can use more often than the real recursive patterns.
(Maybe a remark about this functionality could be added to the documentation,
but it isn't a big deal.)
Well, but DEFINE isn't supported in regex, is it?
I can see the complex possibilities it provides, but I don't think, I would
(currently) want to use this from within a regex pattern in python.
However, if it would be implemented, it would certainly add further "power" in
pattern building, if you find it reasonable.
regards,
vbr
Original comment by Vlastimil.Brom@gmail.com
on 8 Jul 2012 at 10:05
Just to confirm, DEFINE isn't supported in a regex. No-one has requested it.
Original comment by re...@mrabarnett.plus.com
on 8 Jul 2012 at 6:35
Original issue reported on code.google.com by
Vlastimil.Brom@gmail.com
on 7 Jul 2012 at 10:48