From 2cf85567593d15e5c605dd108092063ace1936b6 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Tue, 27 Feb 2024 17:59:06 -0500 Subject: [PATCH] Python: Define re patterns using raw strings --- project/htmlcombine.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/htmlcombine.py b/project/htmlcombine.py index a883f69..a519c93 100755 --- a/project/htmlcombine.py +++ b/project/htmlcombine.py @@ -32,7 +32,7 @@ # parse majorheading with open( options.body, 'r' ) as f: - rx = re.compile( '^.*class="majorheading".*>([^>]+)' ) + rx = re.compile( r'^.*class="majorheading".*>([^>]+)' ) for line in f: m = rx.match( line ) if not m: @@ -40,9 +40,9 @@ title = m.group( 1 ) break -m = re.compile( '(\S+)\s+(\S+)\s+(.+)' ).match( title ) +m = re.compile( r'(\S+)\s+(\S+)\s+(.+)' ).match( title ) if m: - shortTitle = m.group(3) + shortTitle = m.group( 3 ) else: shortTitle = title