--- perl_matcher_common.hpp 2007-11-14 15:49:11.000000000 -0800 +++ perl_matcher_common.hpp.original 2007-11-14 10:55:42.000000000 -0800 @@ -532,23 +532,25 @@ template bool perl_matcher::match_within_word() { - bool b; if(position == last) return false; - - b = traits_inst.isctype(*position, m_word_mask); - - if((position == backstop) && ((m_match_flags & match_prev_avail) == 0)) - return false; - --position; - b ^= traits_inst.isctype(*position, m_word_mask); - b = !b; - ++position; - - if(b) + // both prev and this character must be m_word_mask: + if(traits_inst.isctype(*position, m_word_mask)) { - pstate = pstate->next.p; - return true; + bool b; + if((position == backstop) && ((m_match_flags & match_prev_avail) == 0)) + return false; + else + { + --position; + b = traits_inst.isctype(*position, m_word_mask); + ++position; + } + if(b) + { + pstate = pstate->next.p; + return true; + } } return false; }