diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 15d284d0..d68943cd 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -49,7 +49,7 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char { return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask); } -#if !defined(__HP_aCC) +#if !defined(__hpux) // can't use WCHAR_MIN in pp-directive #if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask) { diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp index 7e857963..1e98b342 100644 --- a/include/boost/regex/v4/perl_matcher_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_recursive.hpp @@ -275,13 +275,11 @@ bool perl_matcher::match_rep() #pragma warning(disable:4127 4244) #endif const re_repeat* rep = static_cast(pstate); - if(next_count->get_id() != rep->id) - { - // we're moving to a different repeat from the last - // one, so set up a counter object and recurse: - repeater_count r(rep->id, &next_count, position); - return match_rep(); - } + // + // Always copy the repeat count, so that the state is restored + // when we exit this scope: + // + repeater_count r(rep->id, &next_count, position); // // If we've had at least one repeat already, and the last one // matched the NULL string then set the repeat count to diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index 44b9aed8..cc1df915 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -77,7 +77,7 @@ inline bool is_combining(unsigned char) { return false; } -#ifndef __HP_aCC +#ifndef __hpux // can't use WCHAR_MIN/MAX in pp-directives. #ifdef _MSC_VER template<> inline bool is_combining(wchar_t c) diff --git a/include/boost/regex/v4/u32regex_token_iterator.hpp b/include/boost/regex/v4/u32regex_token_iterator.hpp index ad75d76a..a8d394e4 100644 --- a/include/boost/regex/v4/u32regex_token_iterator.hpp +++ b/include/boost/regex/v4/u32regex_token_iterator.hpp @@ -67,7 +67,7 @@ public: #elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) + || BOOST_WORKAROUND(__HP_aCC, < 60700) template u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) : end(last), re(*p), flags(f) @@ -200,7 +200,7 @@ public: #elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ - || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) + || BOOST_WORKAROUND(__HP_aCC, < 60700) template u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const T& submatches, match_flag_type m = match_default) diff --git a/test/regress/test_tricky_cases.cpp b/test/regress/test_tricky_cases.cpp index e53024b3..609f4e61 100644 --- a/test/regress/test_tricky_cases.cpp +++ b/test/regress/test_tricky_cases.cpp @@ -373,6 +373,10 @@ void test_tricky_cases3() TEST_REGEX_SEARCH("\\l+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2)); TEST_REGEX_SEARCH("\\u+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2)); TEST_REGEX_SEARCH("(a)(?:b)", perl|nosubs, "ab", match_default, make_array(0, 2, -2, -2)); + // bug reported 2006-09-20: + TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds123456789b", match_default, make_array(0, 34, -2, -2)); + TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds12345678", match_default, make_array(-2, -2)); + TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds", match_default, make_array(-2, -2)); //