I'm using Python to process a text file, line by line, using RegEx. The first line includes the pattern to be matched, but for some reason Python isn't matching it. If I add a blank line—and make no other changes—it matches that line.
Any thoughts on why this might be happening?
Here's the relevant code:
infile = open(filename, 'r')
fulltext = infile.readlines()
pattern = r'{LO[^{]*}(.)\s(.*)'
regex = re.compile(pattern)
for line in fulltext:
match = re.match(regex,line)
Here's that first line. Again, it matches when it's not the first line, so I don't see what the issue is.
{LO 1.1a}m Plain text here.