Skip to content Skip to sidebar Skip to footer

Why Is Python Regex Wildcard Only Matching Newline

I am writing a program to parse through log messages using Python RegEx. I've gotten everything situated up until the message of the log. This could be any number of types of cha

Solution 1:

in http://www.regex101.com the regex does not work correctly because .* only captures until newline character, meaning at the linebreak from i.e. line 3 to 4 it stops matching. maybe try re.compile() and compile the regex before re.match(). in python regex module there is the DOTALL flag that enables . to match newline characters as well http://docs.python.org/2/library/re.html


Post a Comment for "Why Is Python Regex Wildcard Only Matching Newline"