two ideoms at one blow: line-reading and regexp-matching

Jason Orendorff jason at jorendorff.com
Wed Feb 20 14:17:02 EST 2002


Gustavo Cordova wrote:
> >>> class WrapRX:
> ... [...]

This is standard in Python 2.2.

  >>> import re
  >>> rx_vowels = re.compile(r"[aeiou]+", re.S)
  >>> some_string = "This is a beautiful string."
  >>> for match in rx_vowels.finditer(some_string):
  ...     print "Found vowel: %r" % match.group(0)
  ...

## Jason Orendorff    http://www.jorendorff.com/






More information about the Python-list mailing list