From 41d7c59e80e58de2b82e3759c8de14ee8aedb564 Mon Sep 17 00:00:00 2001 From: "Matthew Horsfall (alh)" Date: Wed, 22 Oct 2014 20:56:47 -0400 Subject: 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. --- dump.c | 1 + 1 file changed, 1 insertion(+) (limited to 'dump.c') diff --git a/dump.c b/dump.c index f888a48be7..0ed7962bd8 100644 --- a/dump.c +++ b/dump.c @@ -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,"}, -- cgit v1.2.1