re = /[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+\.[0-9]{1,3}+.*REST REQUEST(?:\n[^\S\n]*\S.*)+/m
str = '12:56:13.861 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [1]
METHOD:= [GET]
PARAMETERS & VALUES :=
REQUEST:= [/rest/indexv2/getMetadata]
12:56:13.861 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 1 seconds
13:14:46.049 [http-nio-7777-exec-2] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [2]
METHOD:= [GET]
PARAMETERS & VALUES := [pagesize:= 20][name:= Mosolv][page:= 1][tolerance:= 4]
REQUEST:= [/rest/indexv2/getProds/{{licensekey}}/{{username}}/%7B%22tolerance%22:%224%22,%22pagesize%22:%2220%22,%22name%22:%22Mosolv%22,%22page%22:%221%22%7D]
13:14:46.050 [http-nio-7777-exec-2] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 2 seconds
12:57:14.812 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - REST REQUEST
NUMBERS OF REQUESTS:= [3]
METHOD:= [GET]
PARAMETERS & VALUES :=
REQUEST:= [/rest/indexv2/getMetadata]
12:57:14.813 [http-nio-7777-exec-1] INFO dg.mpro.filter.CustomRequestLoggingFilter - Response time: 1 seconds'
# 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