Reading 2 files and comparing them line by line. The files contain the character '.' and hence it matches more than '.'. As you know this matches any char. how do I tell fullmatch to treat every char as they are? Should I be using any other function instead of re.fullmatch? for line1 in lines1: names1=line1.split(' ') name1,cname1=names1 for line2 in lines2: names2=line2.split(' ') name2,cname2=names2 if re.fullmatch(r"name1", "name2", re.IGNORECASE): if(cname1==cname2): next else: print(line1," ",line2) else: next sample input file1: host1.qa host1.c1.com file2: host1-qa host2.d1.com This script takes host1.qa and host1-qa to be the same due to matching of '.' Need exact match. How to achieve that? Continue reading...