re = /^(?<date_time>[^;]*);(?<token>[^;]*);(?<field3>[^;]*);(?<field4>[^;]*);(?<field5>[^;]*);(?<url>[^;]*);(?<respTime>[^;]*);(?<field8>[\S]*)/m
str = '2016-11-29 17:38:51,966;;;;RTI;/messages;2;log-rest
2016-11-29 17:38:51,911;;messages;service;;;0;log-rest
2016-11-29 17:38:51,880;13cpvmx3bXE/4i0fqgB20H2Zke7vJ41q;sendmyorder;portlet;RT;overView;40;customers
2016-11-29 17:38:51,793;zsFS6vnZoASelCFNv8wH7iiPMV1SmDR2IimbDntp2+MOs2azPOSsFSbXEjmMX6sPNJV63vq6UE3GhQPAGtxd7A==;;;RTI;/wsdl/contact/chain;2;www-api'
# 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