musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/regex/regcomp.c 6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index ccd3755b..b3dbb252 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -838,6 +838,9 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s)
s--;
break;
case '{':
+ case '+':
+ case '?':
+ /* extension: treat \+, \? as repetitions in BRE */
/* reject repetitions after empty expression in BRE */
if (!ere)
return REG_BADRPT;
@@ -993,7 +996,8 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
}
if (*s=='\\' && ere)
break;
- if (*s=='\\' && s[1]!='{')
+ /* extension: treat \+, \? as repetitions in BRE */
+ if (*s=='\\' && s[1]!='+' && s[1]!='?' && s[1]!='{')
break;
if (*s=='\\')
s++;
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月23日 06:43:53 +0000

AltStyle によって変換されたページ (->オリジナル) /