What's regex to parse to return all match datas?

I would like to parse a text to get array of mentioneess from that text :

class Mentionee
  attr_reader :id, :display_name

  def initialize(id:, display_name:)
    @id = id
    @display_name = display_name
  end

  def self.parse(text)
     # ???
  end
end

mentionees = Mentionee.parse('@[1:John C.] @[2:Smith X.] you are awesome!')
mentioneess[0].id            # => '1'
mentioneess[0].display_name  # => 'John C.'
mentioneess[1].id            # => '2'
mentioneess[1].display_name  # => 'Smith X.'

Here is the beginning of a Regex. This will give you two match groups for your example. Not tested, but this should be close.

matches = text.scan(/@\[((\d+):(.*?))\]/)

matches.each_with_object([]) |match, result|
  result << Mentionee.new(match[1], match[2])
end

@frank_west_iii thanks for your response. I got it working here:

class Mentionee
  attr_reader :id, :display_name

  FORMAT = /@\[(?<id>\d+):(?<display_name>[^\]]+)\]/

  def initialize(id:, display_name:)
    @id = Integer(id)
    @display_name = display_name
  end

  def self.parse(text)
    text.to_enum(:scan, FORMAT).map do
      match = Regexp.last_match
      new(id: match[:id], display_name: match[:display_name])
    end
  end
end