Address: http://www.cppblog.com/walkspeed/archive/2007/12/28/39823.html
Header file RegEx. HPP
Common classes
Boost: RegEx Regular Expression
Boost: cmatch uses the char array as the container to store matching return values.
Boost: smatch uses STD: string as the container and stores the matching return value.
Boost: regex_match matchAlgorithm
Boost: regex_search Search Algorithm
Boost: regex_replace replacement algorithm
Simple Example
# Include <iostream>
# Include <boost/RegEx. HPP>
Int main (INT argc, char * argv [])
{
Char * Buf = "this is boost: RegEx example ";
Boost: RegEx exampleregex ("Boost: RegEx ");
Boost: cmatch result;
If (boost: regex_search (BUF, result, exampleregex ))
{
STD: cout <result. STR () <STD: Endl;
}
Return 0;
}
Compile: G ++-g-wall-O0 Reg. CC-O reg-lboost_regex// Boost_regex the Regular Expression Library requires additional installation
Note the inclusion of RegEx. HPP. You need to set the seat of the boost header file in the development tool.
End