So im practicing some RegEx in python and essentially I want to look through a log of transaction numbers and see if any of them are returning an error such as Error in phone Activation. I was successful in searching in a dictionary for something that starts with Error and then ends with Activation, so that if it was tablet, watch, etc , it would still find the error. However, as a bulk text file, it will not successfully find the pattern. So the code I used to find it in a dictionary was such that the dictionary key was a transaction number and the error (or lack thereof) was the value: for i in Transaction_Log: if bool(re.search("^Error.* Activation$", Transaction_Log)): print("Found requested error in transaction number " + i) error_count += 1 This works, however using the same search function cant find anything when in a text file setup like this: Transnum: 20190510001 error: Error in phone Activation, Transnum: 20190510002 error: none, Transnum: 20190510003 error: Error in tablet Activation, Ideally, it can find the type of errors, and when successful I can make a counter to see how many there are, however my boolean statement is not True when searching this way through a text file. Searching for just the word Error does work though. Continue reading...