I am using python's re module to search in a string for certain words.
For a simple example, I have a list called valid_words and a string called valid_string.
valid_string = "Use Use%"
valid_words = ['Use', 'Use%']
for header in valid_words:
regex_search = re.search("\\b"+header+"\\b", valid_string)
if regex_search:
print header
However, this only returns Use and not Use%. I think this is because the % in 'Use%' is being treated as a regular expression. Am I correct? Is there a way to get around this?