summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c5
-rw-r--r--regexp.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index de957893bf..c080fcdeab 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4442,7 +4442,7 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
SvFLAGS(rx) |= SvUTF8(pattern);
*p++='('; *p++='?';
if (has_minus) { /* If a default, cover it using the caret */
- *p++='^';
+ *p++= DEFAULT_PAT_MOD;
}
if (has_p)
*p++ = KEEPCOPY_PAT_MOD; /*'p'*/
@@ -6120,7 +6120,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
RExC_parse--; /* for vFAIL to print correctly */
vFAIL("Sequence (? incomplete");
break;
- case '^': /* Use default flags with the exceptions that follow */
+ case DEFAULT_PAT_MOD: /* Use default flags with the exceptions
+ that follow */
has_use_defaults = TRUE;
STD_PMMOD_FLAGS_CLEAR(&RExC_flags);
goto parse_flags;
diff --git a/regexp.h b/regexp.h
index 198b51017c..17f998310e 100644
--- a/regexp.h
+++ b/regexp.h
@@ -247,6 +247,7 @@ and check for NULL.
* for compatibility reasons with Regexp::Common which highjacked (?k:...)
* for its own uses. So 'k' is out as well.
*/
+#define DEFAULT_PAT_MOD '^' /* Short for all the default modifiers */
#define EXEC_PAT_MOD 'e'
#define KEEPCOPY_PAT_MOD 'p'
#define ONCE_PAT_MOD 'o'