0

There is a mistake in code, excercise 7/8 of theme "Regular expressions"

Instead of this pattern = r"([\w\.-]+)@([\w\.-]+)(\.[\w\.]+)" should be that pattern = r"([\w\.\-]+)@([\w\.\-]+)(\.[\w\.]+)" because "-" a meta-symbol as well, if we do not enclose it, hyphen turns the group into a diapason

10th Oct 2018, 4:31 PM
Anastasia Murashova
Anastasia Murashova - avatar
1 Resposta
+ 2
Aren't hyphens that are not in between characters interpreted literally? Escaping can make it clearer, but it's not an error to not escape
10th Oct 2018, 6:57 PM
Evan B
Evan B - avatar