Boost logo

Boost Users :

From: shintarou_fujiwara (shin216_at_[hidden])
Date: 2005-12-04 15:46:36


Hello,Sir and everybody.

> Presumably you need to add the -lboost_regex to your linkers command line.

OK,it worked!!
Thank you for your advice.
I'v change my test program a little.
**************************
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main()
{
        const char* re ="[0-9](.*)";
        regex expression(re);
        const char* str= "1234567890";
        cmatch what;
        regex_match(str,what,expression);
        cout << "success" <<endl;
}
***************************
and Makefile also,
***************************
a.out: main.o
        gcc -lboost_regex -o a.out main.o
main.o: main.cpp
        gcc -c main.cpp
***********************************************************
Shintarou Fujiwara
Officer,System-Informations,Signal School,JGSDF
***********************************************************

On Sun, 4 Dec 2005 10:22:13 -0000
"John Maddock" <john_at_[hidden]> wrote:

> > Hi, from Japan.I'm pretty new to c++ and I'm trying to work out on
> > regex. When I compile these lines,it ends with "undefined reference
> > to ..." Please let me know how to use regex properly.
> > I use on FC4 and newest boost version,compiling in Anjuta.
>
> You don't say what compiler you're using?
> Presumably you need to add the -lboost_regex to your linkers command line.
>
> Note also that [0-9] will only match the first character of "1234567890" so
> the call to regex_match will fail (regex_match requires that the whole of
> the text is matched in order to succeed). Use regex_search if you want to
> match a sub-string of the text.
>
> John.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net