aboutsummaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 40118055..618a3a9c 100644
--- a/regex.c
+++ b/regex.c
@@ -502,6 +502,16 @@ re_compile_pattern (pattern, size, bufp)
while (1)
{
PATFETCH (c);
+
+ /* If awk, \ escapes a ] when inside [...]. */
+ if ((obscure_syntax & RE_AWK_CLASS_HACK)
+ && c == '\\' && *p == ']')
+ {
+ PATFETCH(c1);
+ b[c1 / BYTEWIDTH] |= 1 << (c1 % BYTEWIDTH);
+ continue;
+ }
+
if (c == ']' && p != p1 + 1) break;
if (*p == '-' && p[1] != ']')
{