Using [] with the Safe Navigation Operator in Ruby August 22, 2023 by Tarik Just use the ordinary (non-sugar) form. request.path.match(/\A\/(?<slug>(?!admin|assets)\w+)/)&.[](:slug)