Thursday, 16 August 2012

boost regex usage

Good thing in C++.

Just define your regular expression, and put a string to check if it matches. 

for example: 
       boost::regex pureNumberReg("(^[1-9]+[0-9]*)|(^(([1-9]+)|([0-9]+\.[0-9]{1,}))$)");
        return boost::regex_match(value,pureNumberReg);


Easy.

But on windows, it may have some link error message for MD, MT things.

By using BOOST_ALL_NO_LIB, it will force boost won't import the library during compilation.

No comments:

Post a Comment