Winning Jeopardy function to normalize questions and answers

Screen Link:
https://app.dataquest.io/m/210/guided-project%3A-winning-jeopardy/2/normalizing-text

Can anyone tell me,please, why str.replace() doesn’t working:

My Code:

text = 'A, bbbgdd:3jj ' 
text = text.replace("\W",'')

What I expected to happen:
text == 'A bbbgdd3jj ’

What actually happened:
text == 'A, bbbgdd:3jj ’

Thanks!

Heya! Looks like you’re trying to use regex as a pattern in the standard str.replace() function — this is only supported in pandas’ vectorized str.replace() method. You would need to import the re module if you’re planning on using regex to replace characters in a regular string:

https://docs.python.org/3/library/re.html#re.sub

Thank you for your answer!
It looks like you are right, I need to use the function re.sub() instead of str.replace() in case of using regex.