Ticket #698: boostbug698.cpp

File boostbug698.cpp, 568 bytes (added by Stephen Wassell <stephen.wassell@…>, 11 years ago)

Sample code demonstrating this bug (compiles with MSVC9)

Line 
1/*
2 * Output seen due to bug #698:
3 * "HOG" : not matched
4 * "dog" : matched
5 *
6 * Expected output when fixed:
7 * "HOG" : matched
8 * "dog" : matched
9 */
10
11#include <iostream>
12#include <boost/regex.hpp>
13
14void test(wchar_t *str, boost::wregex &re)
15{
16 std::wcout << L"\"" << str << L"\" : "
17 << (boost::regex_search(str, re) ? L"matched" : L"not matched")
18 << std::endl;
19}
20
21int main()
22{
23 boost::wregex re;
24
25 re.assign(L"(?i)[dh]og");
26
27 test(L"HOG", re);
28 test(L"dog", re);
29
30 return 0;
31}