You can use \b
for word boundary, so 'xxx abcd'
can get replaced. Since the x
and
can be interleaved and you would remove them all, you can just use:
s.str.replace(r'\b[x\s]+\b',' ')
Output:
0 transworld system inc trying colect debt mine ...
1 complaint cals ocur betwen cel job
2 company violated
3 previously requested experian actualy mine ins...
4 company trans union noticed
dtype: object
CLICK HERE to find out more related problems solutions.