Reputation: 2951
Is this the correct way to remove everything between two backward slashes?
clean = re.sub(r'\\.+?\\', '', clean)
Example input:
a\ue00f\ue010\ue011\ue012\ue013\a
Example output:
aa
Upvotes: 0
Views: 894
Reputation: 1746
Maybe split() can help here:
>>> input = r'a\ue00f\ue010\ue011\ue012\ue013\a'
>>> elems = input.split('\\')
>>> ''.join((elems[0], elems[-1]))
'aa'
Upvotes: 1