Regular Expressions: Matching and Extracting Data

In lesson 11 - RegEx B - Python for Everybody Course.
The following regex is used: '\S+@\S+', but in the exercise the regex is different: '\\S+@\\S+' . Two extra backslash characters are used, but the outcome is the same. I don’t understand why the extra \ does not affect the regex (should escape a special character).
https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/regular-expressions-matching-and-extracting-data

1 Like