Can I make a regex array to iterate through in C++? I have to check a string to various regular expressions in C++. Up to now, I've done this using something similar to this:

regex regex_a (".."); string rewrite_a = "($1/$2)";
regex regex_b (".."); string rewrite_b = "($1)";
regex regex_c (".."); string rewrite_c = "($2)";

if (regex_match(string, regex_a)) {
    cout &lt;&lt; regex_replace(string, regex_a, rewrite_a);
} else if (regex_match(string, regex_b)) {
    cout &lt;&lt; regex_replace(string, regex_b, rewrite_b);
} else if (regex_match(string, regex_c)) {
    cout &lt;&lt; regex_replace(string, regex_c, rewrite_c);
} 


Is this the cleanest way to do this? Isn't there a way to make a regex array and iterate through that? It would make the code much more readable.
Probably like this:

C++11:

vector&lt; pair&lt;regex, string&gt; &gt; regex_pairs = { {regex(".."), "($1/$2)"}, {regex(".."), "($1)"}, {regex(".."), "($2)"} };
for(auto pa:regex_pairs){
    cout &lt;&lt; regex_replace(string, pa.first, pa.second);
}


C++03:

vector&lt; pair&lt;regex, string&gt; &gt; regex_pairs;
regex_pairs.push_back(make_pair(regex(".."), "($1/$2)"));
regex_pairs.push_back(make_pair(regex(".."), "($1)"));
regex_pairs.push_back(make_pair(regex(".."), "($2)"));
for(vector&lt; pair&lt;regex, string&gt; &gt;::iterator it = regex_pairs.begin();it!=regex_pairs.end(); it++){
    cout &lt;&lt; regex_replace(string, it-&gt;first, it-&gt;second);
}