[code.view]

[top] / python / PyMOTW / re / re_escape_codes.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Escape codes
     """
     #end_pymotw_header
     
     from re_test_patterns import test_patterns
     
     test_patterns('This is a prime #1 example!',
                   [ r'\d+', # sequence of digits
                     r'\D+', # sequence of non-digits
                     r'\s+', # sequence of whitespace
                     r'\S+', # sequence of non-whitespace
                     r'\w+', # alphanumeric characters
                     r'\W+', # non-alphanumeric
                     ])
     

[top] / python / PyMOTW / re / re_escape_codes.py

contact | logmethods.com