what is the proper regex to check for a gmail address
-
Hello,
i only need to check if it contains "gmail.com" after the @, anything before doesn't matter
i found various, but none did the job.
smatch match; regex r("gmail.com"); if(regex_search(iter->second, match, r)){ std::cout << iter->first << std::endl; }
this doesn't cut the mostard.
alice alice@alicegmail.com alice alice@gmail.com
regards.
-
And why in 'C++ Gurus'? Doing a simply QString::endsWidth() so hard to need a c++ guru?
-
@Natural_Bugger
So did you try^.*@gmail\.com$
?Though as @Christian-Ehrlicher says, as stated by you it doesn't need a regular expression anyway.
-
sorry, i didn't know what was the right section.
-
Please feel free to ignore me if I am "overthinking" the nature of your task...
I'm wondering why exactly anyone would filter precisely and exclusively "gmail.com" addresses. One answer that immediately comes to mind is the use case where you want to use Google OAuth. The user would (I believe) need a provided-by-google email account to participate in Google OAuth. However, filtering by "gmail.com" is overly restrictive for that case. When a business uses Google as their email provider, you can have "me@mybusiness.com" provided under-the-hood by Gmail.