I have a sample string of something like hello \+ \\\world \+ \\\\ this \234 \ is \Pattern\ and I want it to be something like hello + \world + this 234 is \Pattern
One way to do is to run a loop for every character in the string and if it's a \ and next character is NOT a word, then replace it with a space. Simple but inefficient code. There must be another way to do it using regular expression.
I can find all the \alphabet using r'\\\w+' and any single \ followed by space as \\\s+ but these won't take \\\ \( \+ into consideration. How can this be done?