0

I have read the tutorial on this and a fair amount of post and I am having trouble python3 regex matching in multi line mode. Consider the simple test:

text = "abcdef\nghijkl"
exp1 = "^.*(def)"
exp2 = "^.*(jkl)"
print(text)
import re
re.compile(exp1, re.MULTILINE).match(text) is not None
re.compile(exp2, re.MULTILINE).match(text) is not None

This results in:

abcdef
ghijkl
True
False

This is the most basic example I could find, and all the other online regex matching ones of tried show that both should match with multi line but this doesn't. What am I missing? Any help is appreciated. Thank you.

noone392
  • 586
  • 1
  • 8
  • 19

0 Answers0