re.match(r"^[a-z]+[*]?$", s)
- The
^matches the start of the string. - The
[a-z]+matches one or more lowercase letters. - The
[*]?matches zero or one asterisks. - The
$matches the end of the string.
Your original regex matches exactly one lowercase character followed by one or more asterisks.
No comments:
Post a Comment