From: Nikolai Weibull Date: 2005-03-14T06:42:37+09:00 Subject: rb_reg_quote weirdness (Two weirdnesses in one day.) My documentation for Regexp::quote(str) says that a copy of str is returned, yet if str doesn't contain any metacharacters, str itself is returned: VALUE rb_reg_quote(str) VALUE str; { char *s, *send, *t; VALUE tmp; int c; s = RSTRING(str)->ptr; send = s + RSTRING(str)->len; for (; s < send; s++) { c = *s; if (ismbchar(c)) { int n = mbclen(c); while (n-- && s < send) s++; s--; continue; } switch (c) { case '[': case ']': case '{': case '}': case '(': case ')': case '|': case '-': case '*': case '.': case '\\': case '?': case '+': case '^': case '$': case ' ': case '#': case '\t': case '\f': case '\n': case '\r': goto meta_found; } } return str; meta_found: : : is this how it should be, or should str be copied at this point?, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}