diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb
index <HASH>..<HASH> 100644
--- a/activesupport/lib/active_support/core_ext/string/filters.rb
+++ b/activesupport/lib/active_support/core_ext/string/filters.rb
@@ -15,7 +15,7 @@ class String
   # Performs a destructive squish. See String#squish.
   def squish!
     gsub!(/\A[[:space:]]+/, '')
-    gsub!(/[[:space:]]+\Z/, '')
+    gsub!(/[[:space:]]+\z/, '')
     gsub!(/[[:space:]]+/, ' ')
     self
   end
no need for \Z, \z is more concise