The log example is
DHCPRELEASE of 123.4.5.89 from 12:34:45:56:78:90 (Johns-Iphone) via eth1 relay 1.3.4.4
where 123.4.5.89 is ip address, 12:34:45:56:78:90is mac address, Johns-Iphone is Host.
Case 1 - I want this to have no matching group (missing left parenthesis)
DHCPRELEASE of 123.4.5.89 from 12:34:45:56:78:90 Johns-Iphone) via eth1 relay 1.3.4.4
Case 2 - This can be parsed
DHCPRELEASE of 123.4.5.89 from 12:34:45:56:78:90 (Johns-Iphone) via eth1 relay 1.3.4.4
Case 3 - This can be parsed as well
DHCPRELEASE of 123.4.5.89 from 12:34:45:56:78:90 via eth1 relay 1.3.4.4
Case 4 - This can be parsed as well
DHCPRELEASE of 123.4.5.89 from 12:34:45:56:78:90
Here is my regex to parse this particular log:
DHCPRELEASE\sof\s((?:[0-9]{1,3}\.){3}(?:[0-9]{1,3}))\sfrom\s((?:[a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2})(?:\s\((.*?)\))?
However my regex does NOT work what I want. Anyone can help?
Thanks!