summaryrefslogtreecommitdiffstats
path: root/lib/jcode.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-11-08 05:29:37 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-11-08 05:29:37 +0000
commit0104ca814205b03db79a3b0767186ccbc0dab40c (patch)
tree8a63998435ddc0a3367124967bf063f01e7cfbb9 /lib/jcode.rb
parent56627c6963e27078e8007b6465725fc89bfcadf0 (diff)
downloadruby-0104ca814205b03db79a3b0767186ccbc0dab40c.tar.gz
ruby-0104ca814205b03db79a3b0767186ccbc0dab40c.tar.xz
ruby-0104ca814205b03db79a3b0767186ccbc0dab40c.zip
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/jcode.rb')
-rw-r--r--lib/jcode.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/jcode.rb b/lib/jcode.rb
index 0f53b7185..3ce692fc5 100644
--- a/lib/jcode.rb
+++ b/lib/jcode.rb
@@ -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