diff options
author | Matthew Horsfall (alh) <wolfsage@gmail.com> | 2014-10-22 20:56:47 -0400 |
---|---|---|
committer | Matthew Horsfall <wolfsage@gmail.com> | 2014-12-28 09:34:03 -0500 |
commit | 41d7c59e80e58de2b82e3759c8de14ee8aedb564 (patch) | |
tree | 857d2ef14a82e87a9a37349773cf3906a23466ac /dump.c | |
parent | fde14af1e494660628714463be39d015ab768ff4 (diff) | |
download | perl-41d7c59e80e58de2b82e3759c8de14ee8aedb564.tar.gz |
Support for nocapture regexp flag /n
This flag will prevent () from capturing and filling in $1, $2, etc...
Named captures will still work though, and if used will cause $1, $2, etc...
to be filled in *only* within named groups.
The motivation behind this is to allow the common construct of:
/(?:b|c)a(?:t|n)/
To be rewritten more cleanly as:
/(b|c)a(t|n)/n
When you want grouping but no memory penalty on captures.
You can also use ?n inside of a () directly to avoid capturing, and
?-n inside of a () to negate its effects if you want to capture.
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1382,6 +1382,7 @@ const struct flag_to_name regexp_extflags_names[] = { {RXf_PMf_EXTENDED, "PMf_EXTENDED,"}, {RXf_PMf_EXTENDED_MORE, "PMf_EXTENDED_MORE,"}, {RXf_PMf_KEEPCOPY, "PMf_KEEPCOPY,"}, + {RXf_PMf_NOCAPTURE, "PMf_NOCAPURE,"}, {RXf_IS_ANCHORED, "IS_ANCHORED,"}, {RXf_NO_INPLACE_SUBST, "NO_INPLACE_SUBST,"}, {RXf_EVAL_SEEN, "EVAL_SEEN,"}, |