Possible Regexp documentation bug
Chris Wilson <[email protected]> Sun, 15 Jul 2007 18:39:56 +0100 (BST)
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I think I found a small bug in the description of the Regexp.escape method (http://www.ruby-doc.org/core/classes/Regexp.html#M001216). It says: "(Regexp.escape) Escapes any characters that would have special meaning in a regular expression. Returns a new escaped string, or self if no characters are escaped. For any string, Regexp.escape(str)=~str will be true." I think the last part is incorrect. The left-hand side of the =~ operator should be a string, the right-hand side should be a regexp. So if the escape method does change anything, the condition will not hold. I think it would be more accurate to say: "str =~ Regexp.escape(str) will be true." Is that right? And how should one go about changing the documentation? Cheers, Chris. -- _____ __ _ \ __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |