dimanche 10 novembre 2019

How can i search with regex for a special character like a "." or a "-"

I need to make a c++ program that recognizes e-mail adresses. my program must check if a given e-mail contains a "." or a "-". I used regex to do so and it worked only if the "." or "-" was at the very end of the e-mail string. How can i make the regex look for these characters when they are not at the back of the string?

i have already tried using the backslash like [\.] and [\\.] and [\\\\.] but none of these work. I also tried without backslash but that didn't work either.

Aucun commentaire:

Enregistrer un commentaire