From: Eric Hodel Date: 2012-03-17T03:28:34+09:00 Subject: [ruby-core:43355] [ruby-trunk - Bug #6161] Document interpretation of backslashes in string transliterations Issue #6161 has been updated by Eric Hodel. Assignee set to Eric Hodel ---------------------------------------- Bug #6161: Document interpretation of backslashes in string transliterations https://bugs.ruby-lang.org/issues/6161#change-24659 Author: John Firebaugh Status: Open Priority: Normal Assignee: Eric Hodel Category: DOC Target version: ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] =begin The transliteration string accepted by String#tr, #delete, #squeeze, and #count has its own backslash escape syntax (on top of that provided by string literals), but it isn't documented. A backlash character escapes the subsequent character, unless it is the ending character of a range designator (e.g. (({X-\}))) or the final character, in which case it is interpreted literally. This can be used to prevent a leading (({^})) from interpretation as the complement operator and (({-})) from interpretation as the range operator. =end -- http://bugs.ruby-lang.org/