python regex of group match
Question: here is my code:

    
    
    import re
    
    pattern_str = '(?P<style>[^|]*>)\|(?P<tags>[^|]*)'
    
    p = re.compile(pattern_str)
    
    m = p.match('OL|AAAAA')
    a = m.group('style')  # AttributeError: 'NoneType' object has no attribute 'group'
    print a
    

it doesn't work,how to fix it?

THX advance

\----------append1-----------

my python version is 2.6.5


Answer: You have an extra `>` in the `style` pattern:

    
    
    pattern_str = '(?P<style>[^|]*)\|(?P<tags>[^|]*)'
    

