[code.view]

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

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Repetition of patterns
     """
     #end_pymotw_header
     
     from re_test_patterns import test_patterns
     
     test_patterns('abbaaabbbbaaaaa',
                   [ 'ab*?',     # a followed by zero or more b
                     'ab+?',     # a followed by one or more b
                     'ab??',     # a followed by zero or one b
                     'ab{3}?',   # a followed by three b
                     'ab{2,3}?', # a followed by two to three b
                     ])
     

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

contact | logmethods.com