I am trying to split a string based on a particular pattern in an effort to rejoin it later after adding a few characters. Here's a sample of my string: "123\babc\b:123" which I need to convert to "123\babc\\"b\":123". I need to do it several times in a long string. I have tried variations of the following: regex = r"(\\b[a-zA-Z]+)\\b:" test_str = "123\\babc\\b:123" x = re.split(regex, test_str) but it doesn't split at the right positions for me to join. Is there another way of doing this/another way of splitting and joining? Continue reading...