I have the following code which matches the string in comments variable,how do I construct the string that matches for both the comments shown below?I want to check for QSPR TEST RESULTS:\siggy.* and TEST RESULTS:.*
import re
comments = "QSPR TEST RESULTS:\\siggy\QSPRLog\QCA\CST\2016\3\28\TestCaseLogs\N12345678-3_28_16_16_36_29_000_635947797916487681.html are the results"
#comments = "TEST RESULTS:BT ON\OFF LOOKS GOOD"
def matchcomments(comments, matchstring):
matchobj = re.search(matchstring, str(comments))
if matchobj:
return True
return False
def main ():
try:
string = r"QSPR TEST RESULTS:\\siggy\.*"
match = matchcomments(comments, string)
if match == True:
tested_bit_flag = True
else:
#string = r"Included in BIT"
string = r"DONOT MATCH"
match = matchcomments(comments, string)
if match == True:
tested_bit_flag = True
else:
tested_bit_flag = False
except KeyError:
tested_bit_flag = False
print "This gerrit does not have comments:"
print tested_bit_flag
if __name__ == "__main__":
main()