diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-10-09 16:18:59 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-10-09 16:18:59 +0200 |
commit | 960971d43f509557a6bb2a0008a19f353c7caabf (patch) | |
tree | 4098297baddacc301e8299247313d3136ee09611 /xe.c | |
parent | fdf235ec2de459bf6a48e3bd06509bf6ddb1bd51 (diff) | |
download | xe-960971d43f509557a6bb2a0008a19f353c7caabf.tar.gz xe-960971d43f509557a6bb2a0008a19f353c7caabf.tar.xz xe-960971d43f509557a6bb2a0008a19f353c7caabf.zip |
allow \ escapes in ranges
Diffstat (limited to 'xe.c')
-rw-r--r-- | xe.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xe.c b/xe.c index 109e161..664d3e2 100644 --- a/xe.c +++ b/xe.c @@ -436,6 +436,8 @@ perc(char *pat, char *str, int lvl) neg = 1; } for (matched = 0; *pat && *pat != ']'; pat++) { + if (*pat == '\\') + pat++; if (pat[1] == '-' && pat[2] != ']') { if (pat[0] <= *str && *str <= pat[2]) matched = 1; @@ -463,8 +465,11 @@ perc(char *pat, char *str, int lvl) else if (*pat == '}') l--; else if (*pat == '[') - while (*pat && *pat != ']') + while (*pat && *pat != ']') { + if (*pat == '\\' && pat[1]) + pat++; pat++; + } } return e ? perc(pat, e, lvl) : 0; case ',': |