Feb-06-2023, 12:11 PM
I am trying to match all characters between "\x" and "\xk" for instance: in the string "\x - \xo 2:2 \xk".
I set my pattern as:
But this gives same error: re.error: incomplete escape \x at position 0
I set my pattern as:
pattern = "\\x.+\\xk" replaceWith = "<b>" irec=re.sub(pattern, replaceWith, irec)However, this gives me an error in my replace. I also tried:
pattern = r"\x.+\xk" replaceWith = "<b>" irec=re.sub(pattern, replaceWith, irec)
But this gives same error: re.error: incomplete escape \x at position 0