# File lib/rack/mount/regexp_with_named_groups.rb, line 30
      def initialize(regexp)
        regexp = Regexp.compile(regexp) unless regexp.is_a?(Regexp)
        source, options = regexp.source, regexp.options
        @names, scanner = [], StringScanner.new(source)

        while scanner.skip_until(/\(/)
          if scanner.scan(/\?:<([^>]+)>/)
            @names << scanner[1]
          elsif scanner.scan(/\?(i?m?x?\-?i?m?x?)?:/)
            # ignore noncapture
          else
            @names << nil
          end
        end
        source.gsub!(/\?:<([^>]+)>/, '')

        @names = [] unless @names.any?
        @names.freeze

        super(source, options)
      end