multipleSpaces = re.compile(u'\\h+') importantTextString = '\n \n \n \t\t ' importantTextString = multipleSpaces.sub("M", importantTextString)
I would have expected consecutive spaces and tabs to be replaced by M but nothing is being replaced. If I try the following, then I'm left only with M, as expected - multipleSpaces = re.compile(u'\\s+') # both vertical and horizontal importantTextString = '\n \n \n \t\t ' importantTextString = multipleSpaces.sub("M", importantTextString) What I eventually wish to do is have only single spaces in my text and to only have single carriage returns - " one two three four five six " becoming - "one two three four five six " Thanks, Barry -- http://mail.python.org/mailman/listinfo/python-list