re = /(((DC|MB)\d{2}[-]\d{2}[-]\d{2})|(CN0\d{1})|(SYSA)|(ppag)|(METR))/
str = 'DC00-01-14 blabla blabla MB00-07-10 blublu CN03 bli BLI2454 bli bli CN02 bloblo bloblo bloblo SYSA bloublou bloublou bloublou CN06 blaiblai fgdf+-*blaiblai blaiblai METR bly
bly blybly blybly ppag blublib/12-+kjflouBFD 454'
# 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