ruby-changes:58287
From: Kazuhiro <ko1@a...>
Date: Thu, 17 Oct 2019 12:52:24 +0900 (JST)
Subject: [ruby-changes:58287] 37457117c9 (master): Use `\&` instead of `\1` with capture
https://git.ruby-lang.org/ruby.git/commit/?id=37457117c9 From 37457117c941b700b150d76879318c429599d83f Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Thu, 17 Oct 2019 12:51:29 +0900 Subject: Use `\&` instead of `\1` with capture diff --git a/lib/shellwords.rb b/lib/shellwords.rb index a125b89..1eaddce 100644 --- a/lib/shellwords.rb +++ b/lib/shellwords.rb @@ -147,7 +147,7 @@ module Shellwords https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb#L147 # Treat multibyte characters as is. It is the caller's responsibility # to encode the string in the right encoding for the shell # environment. - str.gsub!(/([^A-Za-z0-9_\-.,:+\/@\n])/, "\\\\\\1") + str.gsub!(/[^A-Za-z0-9_\-.,:+\/@\n]/, "\\\\\\&") # A LF cannot be escaped with a backslash because a backslash + LF # combo is regarded as a line continuation and simply ignored. -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/