re = /\]\sA\s+(.*)(microsoft|office|azure|o365|onenote|outlook|windowsupdate)(\(\d+\))(com|net|us)(\(\d+\))\s/m
str = '10/6/2023 6:19:18 AM 149C PACKET 0000023A2A31D8A0 UDP Rcv 10.106.92.80 e32e Q [0001 D NOERROR] A (6)mobile(4)pipe(4)aria(9)microsoft(3)com(0)
UDP question info at 0000023A2A31D8A0
Socket = 816
Remote addr 10.106.92.80, port 54599
Time Query=5683788, Queued=0, Expire=0
Buf length = 0x0fa0 (4000)
Msg length = 0x0030 (48)
Message:
XID 0xe32e
Flags 0x0100
QR 0 (QUESTION)
OPCODE 0 (QUERY)
AA 0
TC 0
RD 1
RA 0
Z 0
CD 0
AD 0
RCODE 0 (NOERROR)
QCOUNT 1
ACOUNT 0
NSCOUNT 0
ARCOUNT 0
QUESTION SECTION:
Offset = 0x000c, RR count = 0
QTYPE A (1)
QCLASS 1
ANSWER SECTION:
empty
AUTHORITY SECTION:
empty
ADDITIONAL SECTION:
empty'
# 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