[code.view]

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

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Regular expression grouping
     """
     #end_pymotw_header
     
     from re_test_patterns import test_patterns
     
     test_patterns('abbaaabbbbaaaaa',
                   [ 'a(ab)',    # 'a' followed by literal 'ab'
                     'a(a*b*)',  # 'a' followed by 0-n 'a' and 0-n 'b'
                     'a(ab)*',   # 'a' followed by 0-n 'ab'
                     'a(ab)+',   # 'a' followed by 1-n 'ab'
                     ])
     

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

contact | logmethods.com