Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-07-13 05:49:27

> Can someone help check me on this code? The problem is that if I use a
> RegEx of:
> ^.*(?=.{4,})(?=(?:.*[A-Z]))(?=(?:.*[a-z])).*$
> The results aren't as expected. I should expect that the password of Aa1
> would fail, and yet it is passing the regex_match.
> I borrowed this code from someone else's project and my concern is that
> Boost_RegEx doesn't work correctly with wide characters. Is this the
> case,
> or is there something else that is causing the problem.

What boost version are you using? The code below works as expected with
Boost-1.32 and with the current cvs (soon to be released as 1.33).


#include <boost/regex.hpp>
#include <iostream>
int main()
std::wstring Password(L"Aa1");
boost::wregex wrePassword(L"^.*(?=.{4,})(?=(?:.*[A-Z]))(?=(?:.*[a-z])).*$");
boost::wsmatch what;
unsigned int flags = boost::match_default;
bool bMatch = regex_match(Password, what, wrePassword);
if (bMatch) {
std::cout << "PasswordFilter: Password matches specified RegEx";
} else {
std::cout << "PasswordFilter: Password does NOT match specified RegEx";
return 0;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at