re = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/m
str = '11-D6-D4-D7-B0-80
B5-42-A1-A7-33-B1
8C-03-74-2B-C6-D1
B5-5E-20-CH-1D-E6
7F-83-86-B6-7A-93
31-CE-78-13-75-FF
E5-EF-62-80-46-BC
D8-G2-44-10-49-E8
C6-45-E2-C5-D8-B3
F2-CA-6C-77-C3-7D
05-A0-4F-8A-F9-71
82-7B-DZ-D5-06-DA
B8-9F-45-90-D9-B3
82-7B-D6-D5-06-DA
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html