Peng Yu wrote:

I would like to match "a::" in "a::b", but not in "a:: b". That is,
the character after "::" should be a alphanumeric character.

sounds like a look-ahead assertion is what you need:

>>> import re
>>> re.match("\w::(?=\w)", "a::b")
<_sre.SRE_Match object at 0x01442138>
>>> _.group()
'a::'
>>> re.match("\w::(?=\w)", "a:: b")
>>>

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to