A bug in the question of Python for Everybody

In this question: https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/regular-expressions-matching-and-extracting-data
the regex pattern should be


instead of


Welcome, promitbasak.

Whilst I would agree that the example in the challenge is not best-practice, it is not wrong.

In much the same way a regex in JavaScript would look like:

const myRegex = /\S+@\S+/

In Python, the same could be:

myRegex = '\\S+@\\S+'
# OR....
myRegex = r'\S+@\S+'

What does not work is:

myRegex = r'\\S+@\\S+'

Hope this clarifies.

I used to have the same question as promitbasak. After looked up the document I find below: In Python you need use Raw String Notation or you need to add an additional backslash as prefix of every backslash in regular expression.
See below link to the Python document.

Raw String Notation