Regular expression is widely used for pattern matching.
Python has a built-in package called re, which can be used to work with Regular Expressions .
The re module contains a function called search(), it can be used to check if a string contains the specified search pattern .
re.search(pattern, string, flags[optional])
Ref: Contains in Paython