I have text for fuzzy searching where user gives text, and I replace with characters used for regex parsing later.
Here is the text saved in configuration_blocks variable:
neighbor 10.1.(()).(())
Here is the code:
configuration_blocks = [sub.replace("$", ".*").replace("(())", "\S+") for sub in configuration_blocks]
However, the result is neighbor 10.1.\ \S
with two backslashes.
How can I do this to get one backslash only?