faubackup2/src/regexp regexp.cpp,1.7,1.8

Erik Merkel <[email protected]> Thu, 06 Oct 2005 01:49:57 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup2/src/regexp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10163/src/regexp

Modified Files:
	regexp.cpp 
Log Message:
adding support for the old "Ignore filename" format from older faubackuprc versions


Index: regexp.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/regexp/regexp.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** regexp.cpp	6 Oct 2005 00:10:21 -0000	1.7
--- regexp.cpp	6 Oct 2005 01:49:55 -0000	1.8
***************
*** 25,51 ****
  	(
  		"(\\\\.)|"  // ?1 user escaped something
! 	        "(\\*\\*)|"    // ?2  **
! 	        "(\\*)|"       // ?3  *
! 	        "(/\\./)|"     // ?4  ./
! 	        "(\\?)|"     // ?5  ?
! 	        "(//*)|"    // ?6   if multiple / is present
! 	        // ?7 replace all other special symbols with its literals
! 	        "([^[:word:]^[:space:]])"
  	);
  
  	static const std::string conversation_replace =
! 	        (
  			"(?1$&)"
! 	                "(?2.*)"
! 	                "(?3[^/]*)"
! 	                "(?4/)"
! 	                "(?5[^/])"
! 	                "(?6/)"
! 	                "(?7\\\\$&)"
! 	        );
  
  	return boost::regex_replace
  	       (String, conversation_exp ,conversation_replace,
! 	        boost::match_default | boost::format_all);
  }
  
--- 25,51 ----
  	(
  		"(\\\\.)|"  // ?1 user escaped something
! 		"(\\*\\*)|"    // ?2  **
! 		"(\\*)|"       // ?3  *
! 		"(/\\./)|"     // ?4  ./
! 		"(\\?)|"     // ?5  ?
! 		"(//*)|"    // ?6   if multiple / is present
! 		// ?7 replace all other special symbols with its literals
! 		"([^[:word:]^[:space:]])"
  	);
  
  	static const std::string conversation_replace =
! 		(
  			"(?1$&)"
! 			"(?2.*)"
! 			"(?3[^/]*)"
! 			"(?4/)"
! 			"(?5[^/])"
! 			"(?6/)"
! 			"(?7\\\\$&)"
! 		);
  
  	return boost::regex_replace
  	       (String, conversation_exp ,conversation_replace,
! 		boost::match_default | boost::format_all);
  }
  
***************
*** 58,63 ****
  
  	String = boost::regex_replace
! 	         (String, replace ,replaceBy,
! 	          boost::match_default | boost::format_all);
  
  	return boost::regex_match(String.begin(),String.end(), what, test);
--- 58,63 ----
  
  	String = boost::regex_replace
! 		 (String, replace ,replaceBy,
! 		  boost::match_default | boost::format_all);
  
  	return boost::regex_match(String.begin(),String.end(), what, test);
***************
*** 67,74 ****
  {
  	static const boost::regex test("[\\s]*#.*|[^\\d\\w]*|\\n"
! 				/*used for compatibility with old faubackup */
! 					"|[\\s]*1;.*"
! 					"|[\\s]*$.*"
! 					"|[\\s]*package.*");
  	boost::match_results<string::iterator> what;
  
--- 67,74 ----
  {
  	static const boost::regex test("[\\s]*#.*|[^\\d\\w]*|\\n"
! 			/*used for compatibility with old faubackup */
! 			"|[\\s]*1;.*"
! 			"|[\\s]*$.*"
! 			"|[\\s]*package.*");
  	boost::match_results<string::iterator> what;
  
***************
*** 94,98 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, Exp ,
! 	                        boost::match_default | boost::format_all))
  	{
  		cerr << "parseCmdArg: I do not understand Location " << String << endl;
--- 94,98 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, Exp ,
! 				boost::match_default | boost::format_all))
  	{
  		cerr << "parseCmdArg: I do not understand Location " << String << endl;
***************
*** 124,128 ****
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		return "";
  	else
--- 124,128 ----
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		return "";
  	else
***************
*** 136,140 ****
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		return "";
  	else
--- 136,140 ----
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		return "";
  	else
***************
*** 148,152 ****
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		return "";
  	else
--- 148,152 ----
  
  	if(!boost::regex_search(line.begin(), line.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		return "";
  	else
***************
*** 160,164 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  	else
--- 160,164 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  	else
***************
*** 171,175 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  	else
--- 171,175 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  	else
***************
*** 184,200 ****
  
  	static const boost::regex test_expression("[-*/,\\d\\s\\w]+:"
! 	                "[-*/,\\d\\s\\w]+:"
! 	                "[-*/,\\d\\s\\w]+:"
! 	                "[-*/,\\d\\s\\w]+:"
! 	                "[-*/,\\d\\s\\w]+:"
! 	                "[-*/,\\d\\s\\w]+");
  
  
  	static const boost::regex expression("[-*/\\d\\s\\w]+:"
! 	                                     "[-*/\\d\\s\\w]+:"
! 	                                     "[-*/\\d\\s\\w]+:"
! 	                                     "[-*/\\d\\s\\w]+:"
! 	                                     "[-*/\\d\\s\\w]+:"
! 	                                     "[-*/\\d\\s\\w]+");
  
  	boost::match_results<string::iterator> what;
--- 184,200 ----
  
  	static const boost::regex test_expression("[-*/,\\d\\s\\w]+:"
! 			"[-*/,\\d\\s\\w]+:"
! 			"[-*/,\\d\\s\\w]+:"
! 			"[-*/,\\d\\s\\w]+:"
! 			"[-*/,\\d\\s\\w]+:"
! 			"[-*/,\\d\\s\\w]+");
  
  
  	static const boost::regex expression("[-*/\\d\\s\\w]+:"
! 			"[-*/\\d\\s\\w]+:"
! 			"[-*/\\d\\s\\w]+:"
! 			"[-*/\\d\\s\\w]+:"
! 			"[-*/\\d\\s\\w]+:"
! 			"[-*/\\d\\s\\w]+");
  
  	boost::match_results<string::iterator> what;
***************
*** 206,211 ****
  	if(boost::regex_match(String.begin(), String.end(), what, expression, boost::match_default)) {
  		list.push_back(getTimeStamp(String));
! 	}
! 	else {
  		static const boost::regex replace_expression_first("([\\*-/\\d\\s\\w]+),[\\*-,/\\d\\s\\w]+");
  		static const boost::regex replace_expression_remain("[\\*-/\\d\\s\\w]+,([\\*-,/\\d\\s\\w]+)");
--- 206,210 ----
  	if(boost::regex_match(String.begin(), String.end(), what, expression, boost::match_default)) {
  		list.push_back(getTimeStamp(String));
! 	} else {
  		static const boost::regex replace_expression_first("([\\*-/\\d\\s\\w]+),[\\*-,/\\d\\s\\w]+");
  		static const boost::regex replace_expression_remain("[\\*-/\\d\\s\\w]+,([\\*-,/\\d\\s\\w]+)");
***************
*** 229,237 ****
  {
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*:|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 	        ")"
  	);
  
--- 228,236 ----
  {
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*:|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 		")"
  	);
  
***************
*** 239,243 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 238,242 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 247,252 ****
  		stamp.year_end = 2000 + atoi(what[2].str().c_str());
  		stamp.year_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.year_begin = -1;
--- 246,250 ----
  		stamp.year_end = 2000 + atoi(what[2].str().c_str());
  		stamp.year_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.year_begin = -1;
***************
*** 256,261 ****
  		else
  			stamp.year_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.year_begin = 2000 + atoi(what[6].str().c_str());
--- 254,258 ----
  		else
  			stamp.year_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.year_begin = 2000 + atoi(what[6].str().c_str());
***************
*** 275,299 ****
  	static const boost::regex replace_expression("(Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)");
  	string output_format("(?1(1))"
! 	                     "(?2(2))"
! 	                     "(?3(3))"
! 	                     "(?4(4))"
! 	                     "(?5(5))"
! 	                     "(?6(6))"
! 	                     "(?7(7))"
! 	                     "(?8(8))"
! 	                     "(?9(9))"
! 	                     "(?10(10))"
! 	                     "(?11(11))"
! 	                     "(?12(12))"
! 	                    );
  
  	String = boost::regex_replace(String, replace_expression, output_format, boost::match_default | boost::format_all);
  
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*:|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 	        ")"
  	);
  
--- 272,296 ----
  	static const boost::regex replace_expression("(Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)");
  	string output_format("(?1(1))"
! 			     "(?2(2))"
! 			     "(?3(3))"
! 			     "(?4(4))"
! 			     "(?5(5))"
! 			     "(?6(6))"
! 			     "(?7(7))"
! 			     "(?8(8))"
! 			     "(?9(9))"
! 			     "(?10(10))"
! 			     "(?11(11))"
! 			     "(?12(12))"
! 			    );
  
  	String = boost::regex_replace(String, replace_expression, output_format, boost::match_default | boost::format_all);
  
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*:|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 		")"
  	);
  
***************
*** 301,305 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 298,302 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 309,314 ****
  		stamp.month_end = atoi(what[2].str().c_str());
  		stamp.month_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.month_begin = -1;
--- 306,310 ----
  		stamp.month_end = atoi(what[2].str().c_str());
  		stamp.month_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.month_begin = -1;
***************
*** 318,323 ****
  		else
  			stamp.month_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.month_begin = atoi(what[6].str().c_str());
--- 314,318 ----
  		else
  			stamp.month_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.month_begin = atoi(what[6].str().c_str());
***************
*** 346,354 ****
  {
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*:|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 	        ")"
  	);
  
--- 341,349 ----
  {
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*:|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 		")"
  	);
  
***************
*** 356,360 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 351,355 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 364,369 ****
  		stamp.day_end = atoi(what[2].str().c_str());
  		stamp.day_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.day_begin = -1;
--- 359,363 ----
  		stamp.day_end = atoi(what[2].str().c_str());
  		stamp.day_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.day_begin = -1;
***************
*** 373,378 ****
  		else
  			stamp.day_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.day_begin = atoi(what[6].str().c_str());
--- 367,371 ----
  		else
  			stamp.day_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.day_begin = atoi(what[6].str().c_str());
***************
*** 401,420 ****
  	static const boost::regex replace_expression("(Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)");
  	string output_format("(?1(1))"
! 	                     "(?2(2))"
! 	                     "(?3(3))"
! 	                     "(?4(4))"
! 	                     "(?5(5))"
! 	                     "(?6(6))"
! 	                     "(?7(7))"
! 	                    );
  
  	String = boost::regex_replace(String, replace_expression, output_format, boost::match_default | boost::format_all);
  
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*:|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 	        ")"
  	);
  
--- 394,413 ----
  	static const boost::regex replace_expression("(Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)");
  	string output_format("(?1(1))"
! 			     "(?2(2))"
! 			     "(?3(3))"
! 			     "(?4(4))"
! 			     "(?5(5))"
! 			     "(?6(6))"
! 			     "(?7(7))"
! 			    );
  
  	String = boost::regex_replace(String, replace_expression, output_format, boost::match_default | boost::format_all);
  
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*:|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 		")"
  	);
  
***************
*** 422,426 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 415,419 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 430,435 ****
  		stamp.weekday_end = atoi(what[2].str().c_str());
  		stamp.weekday_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.weekday_begin = -1;
--- 423,427 ----
  		stamp.weekday_end = atoi(what[2].str().c_str());
  		stamp.weekday_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.weekday_begin = -1;
***************
*** 439,444 ****
  		else
  			stamp.weekday_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.weekday_begin = atoi(what[6].str().c_str());
--- 431,435 ----
  		else
  			stamp.weekday_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.weekday_begin = atoi(what[6].str().c_str());
***************
*** 466,474 ****
  {
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*:|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 	        ")"
  	);
  
--- 457,465 ----
  {
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*:|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*:"
! 		")"
  	);
  
***************
*** 476,480 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 467,471 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 484,489 ****
  		stamp.hour_end = atoi(what[2].str().c_str());
  		stamp.hour_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.hour_begin = -1;
--- 475,479 ----
  		stamp.hour_end = atoi(what[2].str().c_str());
  		stamp.hour_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.hour_begin = -1;
***************
*** 493,498 ****
  		else
  			stamp.hour_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.hour_begin = atoi(what[6].str().c_str());
--- 483,487 ----
  		else
  			stamp.hour_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.hour_begin = atoi(what[6].str().c_str());
***************
*** 518,526 ****
  {
  	static const boost::regex expression(
! 	        "[\\s]*("
! 	        "([\\d]{1,2})[\\s]*$|"
! 	        "(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*$|"
! 	        "([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*$"
! 	        ")"
  	);
  
--- 507,515 ----
  {
  	static const boost::regex expression(
! 		"[\\s]*("
! 		"([\\d]{1,2})[\\s]*$|"
! 		"(\\*)([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*$|"
! 		"([\\d]{1,2})[\\s]*-[\\s]*([\\d]{1,2})([\\s]*/[\\s]*([\\d]{1,2}))?[\\s]*$"
! 		")"
  	);
  
***************
*** 528,532 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 517,521 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 536,541 ****
  		stamp.minute_end = atoi(what[2].str().c_str());
  		stamp.minute_mod = 1;
! 	}
! 	else if(what[3] == "*")
  	{
  		stamp.minute_begin = -1;
--- 525,529 ----
  		stamp.minute_end = atoi(what[2].str().c_str());
  		stamp.minute_mod = 1;
! 	} else if(what[3] == "*")
  	{
  		stamp.minute_begin = -1;
***************
*** 545,550 ****
  		else
  			stamp.minute_mod = 1;
! 	}
! 	else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.minute_begin = atoi(what[6].str().c_str());
--- 533,537 ----
  		else
  			stamp.minute_mod = 1;
! 	} else if((what[6] != "") && (what[7] != ""))
  	{
  		stamp.minute_begin = atoi(what[6].str().c_str());
***************
*** 571,590 ****
  {
  	static const boost::regex expression(
! 	        "[\\s]*" //trailing spaces
! 	        "([\\*-/\\d\\s\\w]+:)" //year
! 	        "([\\*-/\\d\\s\\w]+:)" //month
! 	        "([\\*-/\\d\\s\\w]+:)" //day of month
! 	        "([\\*-/\\d\\s\\w]+:)" //day of week
! 	        "([\\*-/\\d\\s\\w]+:)" //hour
! 	        "([\\*-/\\d\\s\\w]+$)"//minute
  	);
  
  	static const boost::regex expression_without_year(
! 	        "[\\s]*" //trailing spaces
! 	        "([\\*-/\\d\\s\\w]+:)" //month
! 	        "([\\*-/\\d\\s\\w]+:)" //day of month
! 	        "([\\*-/\\d\\s\\w]+:)" //day of week
! 	        "([\\*-/\\d\\s\\w]+:)" //hour
! 	        "([\\*-/\\d\\s\\w]+$)"//minute
  	);
  
--- 558,577 ----
  {
  	static const boost::regex expression(
! 		"[\\s]*" //trailing spaces
! 		"([\\*-/\\d\\s\\w]+:)" //year
! 		"([\\*-/\\d\\s\\w]+:)" //month
! 		"([\\*-/\\d\\s\\w]+:)" //day of month
! 		"([\\*-/\\d\\s\\w]+:)" //day of week
! 		"([\\*-/\\d\\s\\w]+:)" //hour
! 		"([\\*-/\\d\\s\\w]+$)"//minute
  	);
  
  	static const boost::regex expression_without_year(
! 		"[\\s]*" //trailing spaces
! 		"([\\*-/\\d\\s\\w]+:)" //month
! 		"([\\*-/\\d\\s\\w]+:)" //day of month
! 		"([\\*-/\\d\\s\\w]+:)" //day of week
! 		"([\\*-/\\d\\s\\w]+:)" //hour
! 		"([\\*-/\\d\\s\\w]+$)"//minute
  	);
  
***************
*** 593,597 ****
  
  	if(boost::regex_search(String.begin(), String.end(), what, expression,
! 	                       boost::match_default | boost::format_all))
  	{
  		getTimeStamp_year(what[1], time);
--- 580,584 ----
  
  	if(boost::regex_search(String.begin(), String.end(), what, expression,
! 			       boost::match_default | boost::format_all))
  	{
  		getTimeStamp_year(what[1], time);
***************
*** 601,608 ****
  		getTimeStamp_hour(what[5], time);
  		getTimeStamp_minute(what[6], time);
! 	}
! 	else if(boost::regex_search(String.begin(), String.end(), what,
! 	                            expression_without_year,
! 	                            boost::match_default | boost::format_all))
  	{
  		/* ignore year */
--- 588,594 ----
  		getTimeStamp_hour(what[5], time);
  		getTimeStamp_minute(what[6], time);
! 	} else if(boost::regex_search(String.begin(), String.end(), what,
! 				      expression_without_year,
! 				      boost::match_default | boost::format_all))
  	{
  		/* ignore year */
***************
*** 615,620 ****
  		getTimeStamp_hour(what[4], time);
  		getTimeStamp_minute(what[5], time);
! 	}
! 	else
  		throw -1;
  	return time;
--- 601,605 ----
  		getTimeStamp_hour(what[4], time);
  		getTimeStamp_minute(what[5], time);
! 	} else
  		throw -1;
  	return time;
***************
*** 633,641 ****
  
  	static const boost::regex expression(
! 	        "[\\s]*(g[\\s]*:|[\\s]*)[\\s]*"  //global rule?
! 	        "([\\d]{0,2}|0)[\\s]*:"         //years
! 	        "[\\s]*([0]?[0-9]|1[0-2])[\\s]*:"      //months
! 	        "[\\s]*([0-9]|[0-2][0-9]|3[0-1])[\\s]*:"  //days
! 	        "[\\s]*([0-1][0-9]|2[0-3]|[0-9])[\\s]*" //hours
  	);
  	string temp_string;
--- 618,626 ----
  
  	static const boost::regex expression(
! 		"[\\s]*(g[\\s]*:|[\\s]*)[\\s]*"  //global rule?
! 		"([\\d]{0,2}|0)[\\s]*:"         //years
! 		"[\\s]*([0]?[0-9]|1[0-2])[\\s]*:"      //months
! 		"[\\s]*([0-9]|[0-2][0-9]|3[0-1])[\\s]*:"  //days
! 		"[\\s]*([0-1][0-9]|2[0-3]|[0-9])[\\s]*" //hours
  	);
  	string temp_string;
***************
*** 643,647 ****
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
  		throw -1;
  
--- 628,632 ----
  
  	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 				boost::match_default | boost::format_all))
  		throw -1;
  
***************
*** 665,700 ****
  string getTimeStampString(string String)
  {
! 	static  const boost::regex expression("[\\s]*([-/,:@*\\d\\s\\w]+)\".+\"[\\s]*[@*:\\d\\s\\w]+");
  	boost::match_results<string::iterator> what;
  
! 	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
! 		throw -1;
! 	else
  		return what[1];
  }
  
  string getDurationTimeString(string String)
  {
! 	static  const boost::regex expression("[\\s]*.+\".+\"[\\s]*(.+)");
  	boost::match_results<string::iterator> what;
  
! 	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
! 		throw -1;
! 	else
  		return what[1];
  }
  
  string getBackupRuleString(string String)
  {
! 	static  const boost::regex expression("[\\s]*[^\"]+\"(.+)\"[\\s]*[^\"]+");
  	boost::match_results<string::iterator> what;
  
! 	if(!boost::regex_search(String.begin(), String.end(), what, expression,
! 	                        boost::match_default | boost::format_all))
! 		throw -1;
! 	else
  		return what[1];
  }
  
--- 650,699 ----
  string getTimeStampString(string String)
  {
! 	static  const boost::regex expression_new("[\\s]*([-/,:@*\\d\\s\\w]+)\".+\"[\\s]*[@*:\\d\\s\\w]+");
! 	static  const boost::regex expression_old("[\\s]*(i|I)(g|G)(n|N)(o|O)(r|R)(e|E).*");
  	boost::match_results<string::iterator> what;
  
! 	if(boost::regex_search(String.begin(), String.end(), what, expression_new,
! 			       boost::match_default | boost::format_all))
  		return what[1];
+ 	else if(boost::regex_search(String.begin(), String.end(), what, expression_old,
+ 				    boost::match_default | boost::format_all))
+ 		return("*:*:*:*:*:*");
+ 	else
+ 		throw -2;
+ 
  }
  
  string getDurationTimeString(string String)
  {
! 	static  const boost::regex expression_new("[\\s]*.+\".+\"[\\s]*(.+)");
! 	static  const boost::regex expression_old("[\\s]*(i|I)(g|G)(n|N)(o|O)(r|R)(e|E)[\\s]+(.+)[\\s]*");
  	boost::match_results<string::iterator> what;
  
! 	if(boost::regex_search(String.begin(), String.end(), what, expression_new,
! 			       boost::match_default | boost::format_all))
  		return what[1];
+ 	else if(boost::regex_search(String.begin(), String.end(), what, expression_old,
+ 				    boost::match_default | boost::format_all))
+ 		return "0:0:0:0"; //old ignore rule
+ 	else
+ 		throw -3;
  }
  
  string getBackupRuleString(string String)
  {
! 	static  const boost::regex expression_new("[\\s]*[^\"]+\"(.+)\"[\\s]*[^\"]+");
! 	static  const boost::regex expression_old("[\\s]*(i|I)(g|G)(n|N)(o|O)(r|R)(e|E)[\\s]+(.+)[\\s]*");
! 
  	boost::match_results<string::iterator> what;
  
! 	if(boost::regex_search(String.begin(), String.end(), what, expression_new,
! 			       boost::match_default | boost::format_all))
  		return what[1];
+ 	else if(boost::regex_search(String.begin(), String.end(), what, expression_old,
+ 				    boost::match_default | boost::format_all))
+ 		return what[7];
+ 	else
+ 		throw -4;
  }
  
***************
*** 714,718 ****
  
  	if(boost::regex_match(dirname.begin(), dirname.end(), what, expression,
! 	                      boost::match_default | boost::format_all))
  	{
  		struct TimeStamp stamp;
--- 713,717 ----
  
  	if(boost::regex_match(dirname.begin(), dirname.end(), what, expression,
! 			      boost::match_default | boost::format_all))
  	{
  		struct TimeStamp stamp;
***************
*** 757,761 ****
  
  	if(boost::regex_match(dirname.begin(), dirname.end(), what, expression,
! 	                      boost::match_default | boost::format_all))
  	{
  		struct TimeStamp stamp;
--- 756,760 ----
  
  	if(boost::regex_match(dirname.begin(), dirname.end(), what, expression,
! 			      boost::match_default | boost::format_all))
  	{
  		struct TimeStamp stamp;



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl