[Merged!] [MERGE][1.6] Update repo description strings
Andrew Bennetts
andrew at canonical.com
Thu Aug 14 07:39:04 BST 2008
Aaron Bentley wrote:
[...]
> > I also wonder if it isn't because he is using '\[MERGE' as the regex, rather
> > than '\[MERGE\>' as the regex.
>
> FWICT, r'\[MERGE\>' will only match the string "[MERGE>".
> >>> import re
> >>> re.match(r'\[Merge\>', '[Merge>')
> <_sre.SRE_Match object at 0xb7d22950>
> >>> re.match(r'\[Merge\>', '[Merge]')
Python's RE syntax doesn't support the < or > metachars than some engines
support. \b (zero-width match for beginning or end of a word) achieves
something similar:
>>> re.match(r'\[Merge\b', '[Merge]') # does match
<_sre.SRE_Match object at 0x819d838>
>>> re.match(r'\[Merge\b', '[Merged]') # doesn't match
>>>
-Andrew.
More information about the bazaar
mailing list