summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/re.c b/re.c
index 9d1a282..80bfee6 100644
--- a/re.c
+++ b/re.c
@@ -288,11 +288,11 @@ rb_reg_desc(s, len, re)
rb_str_cat2(str, "/");
if (re) {
rb_reg_check(re);
- if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
- rb_str_cat2(str, "m");
/* /p is obsolete; to be removed */
if ((RREGEXP(re)->ptr->options & RE_OPTION_POSIXLINE) == RE_OPTION_POSIXLINE)
rb_str_cat2(str, "p");
+ else if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
+ rb_str_cat2(str, "m");
if (RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)
rb_str_cat2(str, "i");
if (RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED)
@@ -1136,6 +1136,12 @@ rb_reg_options(re)
rb_reg_check(re);
if (RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)
options |= RE_OPTION_IGNORECASE;
+ if ((RREGEXP(re)->ptr->options & RE_OPTION_POSIXLINE) == RE_OPTION_POSIXLINE)
+ options |= RE_OPTION_POSIXLINE;
+ else if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
+ options |= RE_OPTION_MULTILINE;
+ if (RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED)
+ options |= RE_OPTION_EXTENDED;
if (FL_TEST(re, KCODE_FIXED)) {
options |= rb_reg_get_kcode(re);
}