Boost logo

Boost Users :

Subject: Re: [Boost-users] Regular Expression
From: Mickael Wolff (mickael_at_[hidden])
Date: 2009-07-13 11:54:05


Wong Peter a écrit :
> Here is my code:

   It isn't complete. I had to add some boilerplate to compile it.
Please provide a compilable source in the future.

> [code]

> boost::regex searchExpression(userDesignation);
> boost::match_results<std::vector<std::string>::iterator > result;

   Why would you like to use a vector here ? First, the boost::smatch do
the trick. Second, regex_match doesn't find all matches in a row. You
have to forward through the subject to seek all matching.

> boost::regex_match(data.begin(), data.end(), result, searchExpression);

   First and second arguments take an iterator on subject string, not on
result !

> [/code]
>
> The error is
>
> error C2664: 'char
> boost::w32_regex_traits<charT>::translate(charT,bool) const' : cannot
> convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'char'

> --
> Linux

   It supposed to be a joke ? :D

-- 
Mickaël Wolff aka Lupus Michaelis
Racine <http://lupusmic.org>
Blog   <http://blog.lupusmic.org>

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