re = /^message-id: (\S+)$/i
str = 'Message-ID:
<GVAP278MB0310DE2FC290B07EFC17D9BF9F989@GVAP278MB0310.CHEP278.PROD.OUTLOOK.COM>
'
# Print the match result
str.match(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