summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-10-17 12:51:29 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-10-17 12:51:29 +0900
commit37457117c941b700b150d76879318c429599d83f (patch)
treef016965a4fb8c8509c990b93cc57e3c2914c7846
parentd5744aff3a164c358f92ef9dc2cda5c7a7612d97 (diff)
Use `\&` instead of `\1` with capture
-rw-r--r--lib/shellwords.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index a125b8968c..1eaddce7ba 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -147,7 +147,7 @@ module Shellwords
# 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.