I have a string that looks like that:
"\n My name is John\n and I like to go.\n blahblahblah.\n \n\n ".
Note - In this string example, there are 5 white-spaces after the new line character, but it can be any number of white-spaces after.
I would like to replace those "\n "
substrings with just one space using a regex. I've been trying numerous combinations of regex and nothing seems to work right.
On of the regex's I found was theString = string.replace(theString, '/\r?\n|\r/g', ' ')
But it didn't work also.
I'm using python 2.7