about Boost tregex

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
try this :-

boost::tregex reg(_T("\.*csproj\b"), boost::tregex::icase);


Also check list of online regular expression tools :-
http://tajendrasengar.blogspot.com/2011/09/online-regular-expression-regex-tools.html
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.
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
Topic archived. No new replies allowed.