import re
a = "apple\c"
b = "applec"
re.search(pattern, a)
re.search(pattern, b)
while searching the pattern. In example ".+" for Any char one or more reptitions. Here I want to neglect "\" when ".+" identify "\" character in search.
By "neglect" do you mean remove from the output or don't include in the pattern, i.e. find "apple"
?
If former:
>>> a.replace('\\', '')
'applec'
if latter:
>>> re.search(r'[^\\]*', a)
<re.Match object; span=(0, 5), match='apple'>