Hi ! I was curious about something, for the regular expression r"\be[-\s]?mail" I have a question.
What does the “\be” at the begining of the expression do ?
I understand that \b represents a backspace, but I dont see what that would do in this case.
Hi @cdchavezq. The
\b part actually stands for a word boundary and not a backspace. I’m copying this from RegExr: “Matches a word boundary position between a word character and non-word character or position (start / end of string).” So having it there before
e means that it wouldn’t include a string like “late mail” because the “e” is part of another word and not the beginning of one. I hope that makes sense.
To add to what April said,
\b is a backspace when passed to the Python interpreter. When passed to the regex engine, it signifies a word boundary.
This topic should help in understanding the details of what I’m saying.
Thank you so much ! I appreciate it !
Thanks for the information, you guys are awesome !