+
+void yf::QueryRewrite::Rep::rewriteRegex(Z_Query *query) const
+{
+ std::string query_in = yp2::util::zQueryToString(query);
+ std::cout << "QUERY IN '" << query_in << "'\n";
+
+ std::string query_out;
+
+ boost::regex rgx;
+ try{
+ // make regular expression replacement here
+ std::string expression("@attr 1=4");
+ std::string format("@attr 1=4 @attr 4=3");
+ //std::string expression("the");
+ //std::string format("else");
+ //std::string expression("(<)|(>)|\\r");
+ //std::string format("(?1<)(?2>)");
+
+ std::cout << "EXPRESSION '" << expression << "'\n";
+ std::cout << "FORMAT '" << format << "'\n";
+
+ rgx.assign(expression.c_str());
+
+ bool match(false);
+ bool search(false);
+
+ // other flags
+ // see http://www.boost.org/libs/regex/doc/match_flag_type.html
+ //boost::match_flag_type flags = boost::match_default;
+ // boost::format_default
+ // boost::format_perl
+ // boost::format_literal
+ // boost::format_all
+ // boost::format_no_copy
+ // boost::format_first_only
+
+ boost::match_flag_type flags
+ = boost::match_default | boost::format_all;
+
+ match = regex_match(query_in, rgx, flags);
+ search = regex_search(query_in, rgx, flags);
+ query_out = boost::regex_replace(query_in, rgx, format, flags);
+ std::cout << "MATCH '" << match << "'\n";
+ std::cout << "SEARCH '" << search << "'\n";
+ std::cout << "QUERY OUT '" << query_out << "'\n";
+
+ }
+ catch(boost::regex_error &e)
+ {
+ std::cout << "REGEX Error code=" << e.code()
+ << " position=" << e.position() << "\n";
+ }
+
+ //std::cout << "QUERY OUT '" << query_out << "'\n";
+ // still need to fold this new rpn query string into Z_Query structure...
+}
+
+
+