| misserwell (25) | |
|
hi All, I meet a question as below: #include <iostream> #include <atlstr.h> #include "msxml.h" #include <utility> #include <boost/regex/mfc.hpp> #include <cassert> using namespace std; CString name = _T("ServiceRequest.csproj")); boost::tregex reg(_T(".*csproj\b"), boost::tregex::icase); boost::tmatch match; assert(regex_match(name, reg) == true); but the assert is always failes , so strange ? could you help me ? thanks in advance | |
|
|
|
| tajendra (44) | ||
|
try this :- boost::tregex reg(_T("\.*csproj\b"), boost::tregex::icase); Also check list of online regular expression tools :-
| ||
|
|
||
| modoran (1245) | |
| If you use MSVC 2010 there is no need for Boost, as you have <regex> STL header in std::tr1 namespace. I used and works without problems. | |
|
|
|
| misserwell (25) | |
|
Yes , I am using MSVC 2010 , but i met the question , after I tested , I found when I remove "\b" is OK that is , change boost::tregex reg(_T("\.*csproj\b"), boost::tregex::icase); to boost::tregex reg(_T("\.*csproj"), boost::tregex::icase); then ,I found it works properly , hope help others | |
|
|
|