import re
texts = ['This%%is$Matrix%%$script', 'This$#is% Matrix# %!']
for text in texts:
	print(re.sub(r'(?<=[^\W_])[\W_]+(?=[^\W_])', ' ', text))