diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-11-15 07:08:07 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-11-17 07:57:40 +1000 |
commit | f068be5f6314710a508935474b4ac8c139bbbdaf (patch) | |
tree | 26bb910a5360115dc0b9e78138760d8237b3100e /jimregexp.c | |
parent | 07f782492c1bffa922115ebb92dfdb59662a6b4b (diff) | |
download | jimtcl-f068be5f6314710a508935474b4ac8c139bbbdaf.zip jimtcl-f068be5f6314710a508935474b4ac8c139bbbdaf.tar.gz jimtcl-f068be5f6314710a508935474b4ac8c139bbbdaf.tar.bz2 |
Bug fix: [regexp] single braced count was rejected
The form {n} should be considered the same as {n,n}
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jimregexp.c')
-rw-r--r-- | jimregexp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/jimregexp.c b/jimregexp.c index a6b8487..47bb0f8 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -490,11 +490,16 @@ static int *regpiece(regex_t *preg, int *flagp) return NULL; } } - preg->regparse = end; - max = strtoul(preg->regparse + 1, &end, 10); - if (*end != '}') { - preg->err = REG_ERR_UNMATCHED_BRACES; - return NULL; + if (*end == '}') { + max = min; + } + else { + preg->regparse = end; + max = strtoul(preg->regparse + 1, &end, 10); + if (*end != '}') { + preg->err = REG_ERR_UNMATCHED_BRACES; + return NULL; + } } if (end == preg->regparse + 1) { max = -1; |