[Boost-bugs] [Boost C++ Libraries] #6735: Regex pattern matching with wrong string

Subject: [Boost-bugs] [Boost C++ Libraries] #6735: Regex pattern matching with wrong string
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-26 16:12:36


#6735: Regex pattern matching with wrong string
----------------------------------+-----------------------------------------
 Reporter: adarshanto@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.44.0
 Severity: Problem | Keywords: regex
----------------------------------+-----------------------------------------
 Hi,
 I am comparing the regular expression "[0-9]+" with the string "1.2"
 I am expecting the comparison to be a failure as part of the following
 check in ConfigReader.cpp

 if (false == var.CheckValue(tValue)) {
         throw(FormatDisallowed(name, var.m_Allowed, tValue));
 }

 However, looks like CheckValue() is returning a success -> which is
 incorrect.
 I added a print after the checkValue to verify it (which got hit)

 Same is the case for "[0-9]+" and "123abc"
 Please let me know if I am missing something OR is it a known issue.

 thanks,
 Adarsh.


 Tried using gdb. Results follows:
 ========================

 (gdb) p var.m_Allowed
 $12 = {
   static npos = 4294967295,
   _M_dataplus = {
     <std::allocator<char>> = {
       <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data
 fields>},
     members of std::basic_string<char, std::char_traits<char>,
 std::allocator<char> >::_Alloc_hider:
     _M_p = 0x9b98f14 "[0-9]+"
   }
 }


 (gdb) p tValue
 $13 = {
   static npos = 4294967295,
   _M_dataplus = {
     <std::allocator<char>> = {
       <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data
 fields>},
     members of std::basic_string<char, std::char_traits<char>,
 std::allocator<char> >::_Alloc_hider:
     _M_p = 0x9ba54d4 "1.2"
   }
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6735>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC