How to match word boundary?

Peng Yu PengYu.UT at gmail.com
Wed Jul 23 00:33:04 CEST 2008


Hi,

I use r"\ba\b" to match "a". However, I can not use "\ba::\b" to match
"a::b".

I would like to match "a::" in "a::b", but not in "a:: b". That is,
the character after "::" should be a alphanumeric character. Could you
let me know how to do it and why "\b" would not work?

Thanks,
Peng



More information about the Python-list mailing list