Opened 11 years ago

Closed 10 years ago

#6735 closed Bugs (invalid)

Regex pattern matching with wrong string

Reported by: adarshanto@… Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.44.0 Severity: Not Applicable
Keywords: regex Cc:

Description

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"

}

}

Change History (3)

comment:1 by anonymous, 11 years ago

Severity: ProblemNot Applicable

Did some more digging and found out that this is not a bug.

Sorry for the false alarm

comment:2 by viboes, 10 years ago

Component: Noneregex
Owner: set to John Maddock

comment:3 by John Maddock, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.