Python using RegEx to search a webpage for a match in a list Python using RegEx to search a webpage for a match in a list selenium selenium

Python using RegEx to search a webpage for a match in a list


re.search takes a string or a regex object as argument, not a list. You can use something like:

import recriteriainactive = ['Inactive', 'Deleted', 'Terminated', 'Banned', 'Suspended']for x in criteriainactive:    statuscheck = re.search(x, src)    print(x, statuscheck)


re.search takes a regex pattern as it's first argument, not a list. You can search for either of the elements by doing something like

pattern = f'({"|".join(criteriainactive)})'re.search(pattern,scr)