Use regex in Python to extract all the words in a string and calculate the total number of words in the string.
This is an example string
import re

text = "This is an example string"
words = re.findall(r'\w+', text)
print("Total words: " + str(len(words)))