Hello, I have this regex: ^.*(?=(?:.*[A-Z]){2,})(?=(?:.*\d){2,}).*$ According to RegExBuddy, this should match with a string that has two upper cases and two digits. However, using the boost_regex_vc7 dll the result works with two upper case, a single digit, and any other character. For example, AA1! Matches, but it shouldn't. Can someone help me identify if it is RegEx that has the bug, RegExBuddy, or if I am just off my rocker! Thanks Robert
Can someone help me identify if it is RegEx that has the bug, RegExBuddy, or if I am just off my rocker!
Works OK for me with the following test program:
#include
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. ------------------------------------------------------------------------ PUNICODE_STRING Password; wcsncpy(wszPassword, Password->Buffer, Password->Length/sizeof(wchar_t)); wszPassword[Password->Length] = 0; wregex wrePassword(DEFAULT_REGEX); wstrPassword = wszPassword; WriteToLog(L"PasswordFilter: Going to run match"); /// Prepare iterators wstring::const_iterator start = wstrPassword.begin(); wstring::const_iterator end = wstrPassword.end(); match_resultswstring::const_iterator what; unsigned int flags = match_default; bMatch = regex_match(start, end, what, wrePassword); if (bMatch) { WriteToLog(L"PasswordFilter: Password matches specified RegEx"); } else { WriteToLog(L"PasswordFilter: Password does NOT match specified RegEx"); }
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).
John.
#include
participants (2)
-
John Maddock
-
Robert