regex – Using OR operator in re.search for multiple strings in python 3

regex – Using OR operator in re.search for multiple strings in python 3

The regex pattern is a single string.

(foo|bar)

how can i search for multiple strings, with OR between them?

Use an alternation operator |

if re.search(r/wp-(?:admin|includes)/, response):

regex – Using OR operator in re.search for multiple strings in python 3

Leave a Reply

Your email address will not be published.