import re
texts = ['error in node occurred in sstlgh8j at 10pm afterabchjk9j after 12pm',
'error in node occurredsstlgh8j at 10pm after abchjk9j after 12pm']
rx = re.compile(r'\s*(?:abc|sst)\w*')
for mystring in texts:
	print(rx.sub('', mystring))