squarey 0 Newbie Poster

Hi Guys
I am writing a function using boost.regex. It should return false if no brackets are found, true if there is a complete match and an exception is thrown if an odd amount of brackets are found (i.e. only opening bracket but not closing bracket). The problem is it always returns false or throws an exception even if there are some brackets in the string. See code below:

bool has_brackets(string * equation)
{
	boost::regex e("[\\(\\)]");
	boost::match_results<std::string::const_iterator> what;
	if(0 == boost::regex_match(*equation, what, e, boost::match_default | boost::match_partial))
	{
		return false; /*No brackets found*/
	}
	if(what[0].matched) {
		// Complete match
		return true;
		
	}
	// Partial match...
	throw runtime_error("You have specified an incomplete equation.");
}