
bMatch = regex_match(start, end, what, wrePassword);
If all is working corectly the following passwords should pass the RegEx expression I have posted above (it works fiune in PERL or C#/VB.NET):
Password Password1 password1 p@ssword
Any of those should work just fine and they dont. Anyone able to hep me with this one? Your help is greatly appreciated. I just cant figgure out
why a syntax I use in PERL or C#/VB.NET works great but wont work in BOOST.
I believe that you are trying to match the expression against not the whole of the password (which is what regex_match tries to do), but only match a prefix of the password string? If that is the case, then you need to use regex_search, with the match_continuous flag set. Here is my test code: #include <iostream> #include <string> #include <boost/regex.hpp> using namespace std; using namespace boost; int main(char *argv[], char argc) { regex e("(?=\\w*[a-z])(?=\\w*[A-Z])" "|(?=\\w*\\d)(?=\\w*[a-z])" "|(?=\\w*[a-z])(?=\\w*\\d)" "|(?=\\w*[a-z])(?=.*[@#$%^&])" "|(?=\\w*\\d)(?=\\w*[A-Z])" "|(?=\\w*[A-Z])(?=.*[@#$%^&])" "|(?=\\w*\\d)(?=.*[@#$%^&])"); std::string t[] = { "Password", "Password1", "password1", "p@ssword", }; for(int i = 0; i < 4; ++i) { std::cout << regex_search(t[i], e, match_continuous) << std::endl; } return(0); } John.