From 2f2d54535220da098bd5f470fa8b28684dcc1534 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 12 Jan 2016 20:42:46 -0800 Subject: Regex printing not escaping [ and ]. * regex.c (print_rec): Handle '[' and ']' in backslash-adding switch. --- regex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'regex.c') diff --git a/regex.c b/regex.c index 9e770ba3..1b2fbad2 100644 --- a/regex.c +++ b/regex.c @@ -2087,7 +2087,8 @@ static void print_rec(val exp, val stream, int *semi_flag) switch (ch) { case '?': case '.': case '*': case '+': case '(': case ')': case '|': case '~': - case '&': case '%': case '/': case '\\': + case '&': case '%': case '/': + case '[': case ']': case '\\': putc_clear_flag(chr('\\'), stream, semi_flag); put_char(exp, stream); break; -- cgit v1.2.3