I want to search and blank out those sentences which contain words like "masked 111","My Add no" etc. from another sentences like "XYZ masked 111" or "Hello My Add" in python.How can I do that? I was trying to make changes to below codes but it was not working due to spaces.
def garbagefin(x):
k = " ".join(re.findall("[a-zA-Z0-9]+", x))
print(k)
t=re.split(r'\s',k)
print(t)
Glist={'masked 111', 'DATA',"My Add no" , 'MASKEDDATA',}
for n, m in enumerate(t): ##to remove entire ID
if m in Glist:
return ''
else:
return x
The outputs that I am expecting is:
garbagefin("I am masked 111")-Blank
garbagefin("I am My Add No")-Blank
garbagefin("I am My add")-I am My add
garbagefin("I am My MASKEDDATA")-Blank