I have the following regex that works well in Python (due to lookahead assertions).
some_list = re.findall('^(?=Name:)(.*?)(?=USB\ Device\ Filters:)', myinput, re.MULTILINE|re.DOTALL)
See example of myinput
in the code block below.
Name: will always be the beginning of a group and USB Device Filters: will always be the end of a group. Not all lines have a valid key:value, e.g., can have or a blank line.
Name: Server1 10.0.0.11
Groups: /
Guest OS: Ubuntu (64-bit)
<none>
USB Device Filters:
Name: Server2 10.0.0.12
Groups: /
Guest OS: Debian (64-bit)
<none>
USB Device Filters:
Can anyone help me convert this into a valid Golang regex?
The ultimate goal is to parse myinput and get a slice of matched groups.