When I use vim to open the file, the text is shown like:
"<200b>blablabla ^B ewjowqwe"
Here, the <200b>
is unicode \u200b
, and ^B
is \x02
.
I can use regular expression like:
re.sub("\u200b|\x02", "", line)
to remove the special characters.
But now I want to remove all the characters like \u
and \x
,
when I use re.sub("\u.{4}|\x.{2}", "", line)
, it will raise exception "incomplete escape \x at position"
How can I write the regular expression to remove all the special \u
and \x
characters?