Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Ryan Fadholi5,168 Points
Why the + sign in the set doesn't have to be escaped?
Hi, I'm under the impression that if I want to match anything that is an operator in regex I need to escape it using '\', for example when we was looking for the '(' the \ is added before the (.
So, any reason why the + sign inside the set in the email regex isn't escaped and it still works?
James J. McCombiePython Web Development Techdegree Graduate 21,199 Points
do you mean something like this:
if you were trying to match dates in the format dd/dd/yyyy for example (I do not know precisely what part of Kenneth's tutorial you are referring to, so I am making my own example).
you have to use the \ to escape special characters, these include the ( and ) because these define capturing groups in a regex search and will be treated as such if you do not escape them. the + is a special character in regex, it is a quantifier telling the module to look for one or more instances of what comes before it, in the example above it says look for groups of one or more digits. if you escaped it with +, the program would look for + in the thing you are searching through.