|
Boost : |
From: Richard Latter (richard_l_at_[hidden])
Date: 2004-05-19 02:29:07
Hello John,
Many thanks for your help and advice here. It helped me to solve my
problem, the expression I was passing to the function was not valid.
However, I have one more question. I know this is regular expressions here,
but why am I not allowed to use "*tart* instead of "(.*)tart(.*)".
Regards,
Richard
"John Maddock" <john_at_[hidden]> wrote in message
news:00e101c43cd0$8496b570$e6df6b51_at_fuji...
> > I'm probably missing something obivous here.....So please fogive me if
> it's
> > a basic error.
> >
> > I am using regex for the first time on MSVC 6 and would like to create a
> > simple function that could pass in a string and an expression to do a
> > regular match on it. I believe I have successfully compiled this
library,
> > but I don't understand why either of these simple functions are not
> > working....
> >
> > bool TestStr (std::string& szExpr, const std::string& szSearch)
> > {
> > bool bResult=false;
> >
> > boost::regex cExpr(szExpr);
> >
> > bResult = boost::regex_match(szSearch, cExpr);
> >
> > return bResult;
> > }
> >
> > or
> >
> > bool TestStr2 (std::string& szExpr, std::string& szSearch)
> > {
> > return boost::regex_match(szSearch, boost::regex(szExpr));
> > }
> >
> > After debugging these routines, it appears thta the boost::regex
> declaration
> > fails (at least for the first function) returning a Kernel32.dll
exception
> > with some kind of address.
> >
> > The credit card example implies that the search and the regex example I
> have
> > observed keeps the regex expressions as constansts inside the function,
> but
> > I would like to be able to parse in my own string
> >
> > Questions?
> >
> > 1. Wht doesn't any of the functions work?
>
> I would guess there is an exception being thrown somewhere and not getting
> caught, try:
>
> bool TestStr (const std::string& szExpr, const std::string& szSearch)
> {
> bool bResult=false;
> try{
> boost::regex cExpr(szExpr);
> bResult = boost::regex_match(szSearch, cExpr);
> }
> catch(const std::exception & e)
> {
> std::cout << e.what() << std::endl;
> }
> return bResult;
> }
>
> John.
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk