1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-11-08 05:29:37 +00:00
parent 41e41d34d1
commit af328b152b
13 changed files with 109 additions and 43 deletions

View file

@ -5,8 +5,8 @@ class String
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
def _regex_quote(str)
str.gsub(/\W/){|s|
if s == "-" then s elsif s == "\\" then "\\\\" else "\\\\#{s}" end
str.gsub(/[][.\\|*?+{}()]/n){|s|
if s == "\\" then "\\\\" else "\\\\#{s}" end
}
end
private :_regex_quote
@ -93,7 +93,7 @@ class String
def _expand_ch str
a = []
str.scan(/(.|\n)-(.|\n)|(.|\n)/) do |r|
str.scan(/(.)-(.)|(.)/m) do |r|
if $3
a.push $3
elsif $1.length != $2.length