Open this example in the interactive library
Source code
import re
pattern = re.escape('a+b?')
print(bool(re.fullmatch(pattern, 'a+b?')))Sample output
True

Escape user text for matching. A self-contained example using the Python standard library.
Open this example in the interactive library
import re
pattern = re.escape('a+b?')
print(bool(re.fullmatch(pattern, 'a+b?')))True