sajad torkamani
import re

# re.match only searches for match at the beginning
# so this won't return a match
re.match("c", "abcdef")

# re.search will search for match anywhere in the
# string so this will match
re.search("c", "abcdef")
<re.Match object; span=(2, 3), match='c'>

Sources

Tagged: Python

Leave a comment

Your email address will not be published. Required fields are marked *