summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/re.c b/re.c
index 41364a189b..2488ccba95 100644
--- a/re.c
+++ b/re.c
@@ -238,7 +238,13 @@ rb_reg_expr_str(str, s, len)
else {
p = s;
while (p<pend) {
- if (*p == '/') {
+ if (*p == '\\') {
+ rb_str_buf_cat(str, p++, 1);
+ if (p<pend) {
+ rb_str_buf_cat(str, p, 1);
+ }
+ }
+ else if (*p == '/') {
char c = '\\';
rb_str_buf_cat(str, &c, 1);
rb_str_buf_cat(str, p, 1);