regex
#include <regex>
bool IsValidEmail(const std::string& email) {
std::regex pattern(
"^\\s*[a-zA-Z0-9_\\.\\+\\-]+@[a-zA-Z0-9\\.\\-]+\.[a-zA-Z0-9]{2,}\\s*$");
return std::regex_match(email, pattern);
}#include <regex>
bool IsValidPhoneNumber(const std::string& phone) {
std::regex pattern(
"^(\\+\\d{1,2}\\s?)?((\\d{3}\\s?)|(\\d{2,3}-?)|\\d{2,3})\\s?(\\d{3}-?)"
"?\\s?(\\d{4}|\\d{3}-?)\\s?(\\d{4}|\\d{3}-?)\\s*$");
return std::regex_match(phone, pattern);
}#include <regex>
bool IsStrongPassword(const std::string& password) {
std::regex pattern("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,}$");
return std::regex_match(password, pattern);
}