Friday, April 5, 2013

Regex



re.match(r"^[a-z]+[*]?$", s)
  1. The ^ matches the start of the string.
  2. The [a-z]+ matches one or more lowercase letters.
  3. The [*]? matches zero or one asterisks.
  4. 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