diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/regexp.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/regexp.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb index 1a04c70d87..95d06ee6ee 100644 --- a/activesupport/lib/active_support/core_ext/regexp.rb +++ b/activesupport/lib/active_support/core_ext/regexp.rb @@ -9,6 +9,8 @@ class Regexp #:nodoc: class << self def optionalize(pattern) + return pattern if pattern == "" + case unoptionalize(pattern) when /\A(.|\(.*\))\Z/ then "#{pattern}?" else "(?:#{pattern})?" |