Looking for help with Regular Expression

lao_mage jiandong.gu at gmail.com
Wed May 24 01:05:37 EDT 2006


'''\[(.*?)\]'''
?-> when this char after(*, +, ?, {n}, {n,}, {n,m}), the match pattern
is not greedy

e.g.1
String: 512.16[3][b]]
Pattern:'''\[(.*)\]'''
This will match "[3][b]]"

e.g.2
String: 512.16[3][b]]
Pattern:'''\[(.*)?\]'''
This will match "[3]" and "[b]"




More information about the Python-list mailing list