
hallouina-ml@yahoo.fr wrote:
Hello everybody,
I begin with C++ and need to use some regex in my program. So I try to compile this example from the boost website :
http://www.boost.org/libs/regex/example/snippets/captures_example.cpp
but I get this error :
~/developpement/essai_regex/boost$ g++ -o test captures_examples.cpp
There are two issues here: in order to use that specific feature you need to compile both your code and the regex library with BOOST_REGEX_MATCH_EXTRA defined (this isn't the case for any of the other examples). You also need to specify the regex library to link against, so usually: g++ -o test -DBOOST_REGEX_MATCH_EXTRA=1 captures_examples.cpp -lboost_regex See the "repeated captures" section of the docs http://svn.boost.org/svn/boost/trunk/libs/regex/doc/html/boost_regex/capture... for more information on this still-experimental repeated-capture feature. Also note that you *do not* need to turn this feature on to be able to use regular Perl or POSIX style captures. HTH, John.