boost 1.50 unable to make regex_match to work
1) Hi Kai, I wrote const_iterator BOOST_REGEX_CALL end()const { // JME 27/10/16 pour savoir si on passe là, je crée une division par 0 en // esperant que le compilateur ne la détecte pas int ijme1, ijme2; ijme2 = 1; ijme1 = 2; --ijme2; ijme1 = ijme1 / ijme2; return (!this->m_status ? 0 : this->m_expression + this->m_expression_len); // return (this->m_status ? 0 : this->m_expression + this->m_expression_len); JME 26/10/16 } Hoping the divide by 0 error would be thrown but it never appears. So I don't think this bug is annoying me. 2) As I am new to boost and regex I tried a simple test : string pattern = "GHI+"; string chaineatester = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; boost::regex boost_pattern( pattern ); boost::smatch what; int errjme = boost::regex_match( chaineatester, what, boost_pattern ); if (errjme == 1) { *outputLog << "test 1: GHI+ a été trouvé" << endl; } else { *outputLog << "test 1: GHI+ n'a pas été trouvé" << endl; // what[0] contains the whole string // what[1] contains the response code // what[2] contains the separator character // what[3] contains the text message. *outputLog << " what[0]:" << what[0] << endl \ << " what[1]:" << what[1] << endl \ << " what[2]:" << what[2] << endl \ << " what[3]:" << what[3] << endl; } string pattern2 = "GHI"; boost::regex boost_pattern2( pattern2 ); errjme = boost::regex_match( chaineatester, what, boost_pattern2 ); if (errjme == 1) { *outputLog << "test 1bis: GHI a été trouvé" << endl; } else { *outputLog << "test 1bis: GHI n'a pas été trouvé" << endl; *outputLog << " what[0]:" << what[0] << endl \ << " what[1]:" << what[1] << endl \ << " what[2]:" << what[2] << endl \ << " what[3]:" << what[3] << endl; } And here is what I get : test 1: GHI+ n'a pas été trouvé what[0]: what[1]: what[2]: what[3]: test 1bis: GHI n'a pas été trouvé what[0]: what[1]: what[2]: what[3]: What am I doing wrong ? Jean
On 27/10/2016 10:56, MAURICE Jean wrote:
1)Hi Kai, I wrote
const_iterator BOOST_REGEX_CALL end()const
{
// JME 27/10/16 pour savoir si on passe là, je crée une division par 0 en
// esperant que le compilateur ne la détecte pas
int ijme1, ijme2;
ijme2 = 1;
ijme1 = 2;
--ijme2;
ijme1 = ijme1 / ijme2;
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
// return (this->m_status ? 0 : this->m_expression + this->m_expression_len); JME 26/10/16
}
Hoping the divide by 0 error would be thrown but it never appears. So I don’t think this bug is annoying me.
2)As I am new to boost and regex I tried a simple test :
string pattern = "GHI+";
string chaineatester = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
boost::regex boost_pattern( pattern );
boost::smatch what;
int errjme = boost::regex_match( chaineatester, what, boost_pattern );
if(errjme == 1)
{
*outputLog << "test 1: GHI+ a été trouvé" << endl;
}
else
{
*outputLog << "test 1: GHI+ n'a pas été trouvé" << endl;
// what[0] contains the whole string
// what[1] contains the response code
// what[2] contains the separator character
// what[3] contains the text message.
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
string pattern2 = "GHI";
boost::regex boost_pattern2( pattern2 );
errjme = boost::regex_match( chaineatester, what, boost_pattern2 );
if(errjme == 1)
{
*outputLog << "test 1bis: GHI a été trouvé" << endl;
}
else
{
*outputLog << "test 1bis: GHI n'a pas été trouvé" << endl;
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
And here is what I get :
test 1: GHI+ n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
test 1bis: GHI n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
What am I doing wrong ?
I believe the algorithm you are looking for is regex_search, please see the docs for the difference between the two. HTH, John.
Jean
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi John, In fact I am 'studying' an old app that I will have to 'upgrade'. I got the sources and the first step was to upgrade boost from 1.39 to 1.50. My client says : "on my computers (so with 1.39) it works". On my computer it doesn't. So I would like to understand why regex_match 1.39 works and not regex_match 1.50. But if you say that I MUST use regex_seach : it will be a huge work to do (the app is more than 250k lines of C++). I am trying regex_search on me small test program and I come back. Jean -----Message d'origine----- De : Boost-users [mailto:boost-users-bounces@lists.boost.org] De la part de John Maddock Envoyé : jeudi 27 octobre 2016 12:16 À : boost-users@lists.boost.org Objet : Re: [Boost-users] boost 1.50 unable to make regex_match to work On 27/10/2016 10:56, MAURICE Jean wrote:
1)Hi Kai, I wrote
const_iterator BOOST_REGEX_CALL end()const
{
// JME 27/10/16 pour savoir si on passe là, je crée une division par 0 en
// esperant que le compilateur ne la détecte pas
int ijme1, ijme2;
ijme2 = 1;
ijme1 = 2;
--ijme2;
ijme1 = ijme1 / ijme2;
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
// return (this->m_status ? 0 : this->m_expression + this->m_expression_len); JME 26/10/16
}
Hoping the divide by 0 error would be thrown but it never appears. So I don't think this bug is annoying me.
2)As I am new to boost and regex I tried a simple test :
string pattern = "GHI+";
string chaineatester = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
boost::regex boost_pattern( pattern );
boost::smatch what;
int errjme = boost::regex_match( chaineatester, what, boost_pattern );
if(errjme == 1)
{
*outputLog << "test 1: GHI+ a été trouvé" << endl;
}
else
{
*outputLog << "test 1: GHI+ n'a pas été trouvé" << endl;
// what[0] contains the whole string
// what[1] contains the response code
// what[2] contains the separator character
// what[3] contains the text message.
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
string pattern2 = "GHI";
boost::regex boost_pattern2( pattern2 );
errjme = boost::regex_match( chaineatester, what, boost_pattern2 );
if(errjme == 1)
{
*outputLog << "test 1bis: GHI a été trouvé" << endl;
}
else
{
*outputLog << "test 1bis: GHI n'a pas été trouvé" << endl;
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
And here is what I get :
test 1: GHI+ n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
test 1bis: GHI n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
What am I doing wrong ?
I believe the algorithm you are looking for is regex_search, please see the docs for the difference between the two. HTH, John.
Jean
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 27/10/2016 11:34, MAURICE Jean wrote:
Hi John,
In fact I am 'studying' an old app that I will have to 'upgrade'.
I got the sources and the first step was to upgrade boost from 1.39 to 1.50.
My client says : "on my computers (so with 1.39) it works". On my computer it doesn't. So I would like to understand why regex_match 1.39 works and not regex_match 1.50. But if you say that I MUST use regex_seach : it will be a huge work to do (the app is more than 250k lines of C++).
I am trying regex_search on me small test program and I come back.
There should never have been any version of Boost where regex_match would match "GHI+" against "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".
Jean
-----Message d'origine----- De : Boost-users [mailto:boost-users-bounces@lists.boost.org] De la part de John Maddock Envoyé : jeudi 27 octobre 2016 12:16 À : boost-users@lists.boost.org Objet : Re: [Boost-users] boost 1.50 unable to make regex_match to work
On 27/10/2016 10:56, MAURICE Jean wrote:
1)Hi Kai, I wrote
const_iterator BOOST_REGEX_CALL end()const
{
// JME 27/10/16 pour savoir si on passe là, je crée une division par 0 en
// esperant que le compilateur ne la détecte pas
int ijme1, ijme2;
ijme2 = 1;
ijme1 = 2;
--ijme2;
ijme1 = ijme1 / ijme2;
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
// return (this->m_status ? 0 : this->m_expression + this->m_expression_len); JME 26/10/16
}
Hoping the divide by 0 error would be thrown but it never appears. So I don't think this bug is annoying me.
2)As I am new to boost and regex I tried a simple test :
string pattern = "GHI+";
string chaineatester = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
boost::regex boost_pattern( pattern );
boost::smatch what;
int errjme = boost::regex_match( chaineatester, what, boost_pattern );
if(errjme == 1)
{
*outputLog << "test 1: GHI+ a été trouvé" << endl;
}
else
{
*outputLog << "test 1: GHI+ n'a pas été trouvé" << endl;
// what[0] contains the whole string
// what[1] contains the response code
// what[2] contains the separator character
// what[3] contains the text message.
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
string pattern2 = "GHI";
boost::regex boost_pattern2( pattern2 );
errjme = boost::regex_match( chaineatester, what, boost_pattern2 );
if(errjme == 1)
{
*outputLog << "test 1bis: GHI a été trouvé" << endl;
}
else
{
*outputLog << "test 1bis: GHI n'a pas été trouvé" << endl;
*outputLog << " what[0]:" << what[0] << endl \
<< " what[1]:" << what[1] << endl \
<< " what[2]:" << what[2] << endl \
<< " what[3]:" << what[3] << endl;
}
And here is what I get :
test 1: GHI+ n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
test 1bis: GHI n'a pas été trouvé
what[0]:
what[1]:
what[2]:
what[3]:
What am I doing wrong ?
I believe the algorithm you are looking for is regex_search, please see the docs for the difference between the two.
HTH, John.
Jean
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi John, Regex_search is ok. It founds "GHI" and it didn't found "GHJ" ... It's a first step ! Jean
participants (2)
-
John Maddock
-
MAURICE Jean