re = /^(.*)\s+(RC).*(SA_SESSION\S*)\s+-\s+(\S*)/m
str = '2019/10/09 10:49:57 RC A [0001] SA_SESSION_4DADFC2D076747410158D882465E0A93DE45 - admin - Administrator disconnected, class R C'
# 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