re = /^(?s).*Subject:(?<identificationValue>ST[0-9]*)\.\d*\.\d*\.(?<identifier>[0-9]*).*Text: (?<remark>.*)Code:.*$/
str = 'From:stoerungen@fe-trading.at
Subject:ST412.3.3.28 [RCT/28]: Kartenleserfehler, bitte pruefen!
Send date:Mon May 08 13:28:51 CET 2017
Content type:text/plain; charset="iso-8859-1"
System: RCT/FAULT (08.05.2017 13:28:51)
Station: ST412, 4846 Redlham, Gewerbepark Ost 27
Text: Kartenleserfehler, bitte pruefen!
Gruppe: 3
Device: 3
Code: 28'
# 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