3
I have the following regular expression in a C++ format validation function using regex, but it is validating non-standard formats that I want.
b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}b\\.[A-Z]{2,4}b
Email: regex_cpp@net.br Valid
Email: regex_cpp@terra.com.br Valid
Email: regex_cpp@hotmail.com.br.net Valid (não pode validar)
Email: regex_cpp@hotmail.com Valid
Email: regex_cpp@yahoo.com.br Valid
Email: regex_cpp@gmail.com Valid
Email: regex_cpp@bol.com.br Valid
Email: regex.cpp@bol.com Valid
Email: reg_ex.cpp@bol.com Valid
Email: reg_ex.cpp@org.br Valid
Email: reg_ex.cpp@net.org.br Valid
the problem I want to emphasize is the regular expression would have to validate only formats like:
.com
.com.br
.net
.net.br
.org
.org.br
and formats such as:
@terra.com.br
@bol.com.br
@yahoo.com.br
@hotmail.com.br
@hotmail.com
ie the expression should not validate anything after . br
Worst that still not validating correctly look code I’m trying to make this regex work already some three days ago http://pastebin.com/evVcm7FE I also used this one as this on the site REGEX const Std::regex Pattern("[A-Z0-9._%-]+@[A-Z0-9-]+(\.[A-Z]{2,4}){1,2}"); e mesmo assim ainda nao valida
– dark777