Look this >>> import re >>> text="asdfnbd]" >>> m=re.sub("n*?","?",text) >>> print m ?a?s?d?f?n?b?d?]?
I don't understand the 'non-greedy' pattern. I think the repl argument should replaces every char in text and outputs "????????". -- https://mail.python.org/mailman/listinfo/python-list