apologies for spamming and Sorry my bad the solution suggested by MRAB
works fine : )
with open("/tmp/2.repo","r") as f:
for line in f:
for line in f:
result = re.search(r'MSG=attempt to record(.*)LINSNAP', line)
if result:
subpatterns = [r
> Why would you expect a single dictionary? You're doing 3 separate matches!
>
> correct, I didn't knew how to combine it all the patterns
You could just combine the patterns as alternatives:
>
> # The alternatives are matched repeatedly. The final '.' alternative
> # will consume a character i
On 2017-04-19 14:26, Ganesh Pal wrote:
Hello friends,
I am learning regex and trying to use this to my scripts I need some
suggestion on the below code. I need to match all lines of a file that
have a specific pattern
and return them as a dictionary.
Sample line:
'NODE=ADAM-11: | TIME=2017-
Hello friends,
I am learning regex and trying to use this to my scripts I need some
suggestion on the below code. I need to match all lines of a file that
have a specific pattern
and return them as a dictionary.
Sample line:
'NODE=ADAM-11: | TIME=2017-04-14T05:27:16-07:00 | COND=Some lovely