import re
rx = re.compile('''
\(?
([*=])
(\w+)
\)?
''', re.VERBOSE)

string = "Word1 word2 =word3 *word4 word5= word6 word7* (*word8)"
new_string = rx.sub(r'\2\1', string)
print(new_string)