www.txt2re.com can be used to generate a Regular Expression and provide the code to execute the Regular Expression match.
This is one that I created using txt2re to extract xxx (word1) and zzz (word2). Depending on the variability in the format of your source string, you may or may not have to generate a different Regular Expression.
#include <stdlib.h>
#include <string>
#include <iostream>
#include <pme.h>
int main()
{
std::string txt="$(F(\"xxx\", \"zzz\") )";
std::string re1="(\\$)";
std::string re2="(\\()";
std::string re3="(.)";
std::string re4="(\\()";
std::string re5="(\")";
std::string re6="((?:[a-z][a-z]+))";
std::string re7="(\")";
std::string re8="(,)";
std::string re9=".*?";
std::string re10="(\")";
std::string re11="((?:[a-z][a-z]+))";
std::string re12="(\")";
std::string re13="(\\))";
std::string re14=".*?";
std::string re15="(\\))";
PME re(re1+re2+re3+re4+re5+re6+re7+re8+re9+re10+re11+re12+re13+re14+re15,"gims");
int n;
if ((n=re.match(txt))>0)
{
std::string c1=re[1].c_str();
std::string c2=re[2].c_str();
std::string c3=re[3].c_str();
std::string c4=re[4].c_str();
std::string c5=re[5].c_str();
std::string word1=re[6].c_str();
std::string c6=re[7].c_str();
std::string c7=re[8].c_str();
std::string c8=re[9].c_str();
std::string word2=re[10].c_str();
std::string c9=re[11].c_str();
std::string c10=re[12].c_str();
std::string c11=re[13].c_str();
std::cout << "("<<c1<<")"<<"("<<c2<<")"<<"("<<c3<<")"<<"("<<c4<<")"<<"("<<c5<<")"<<"("<<word1<<")"<<"("<<c6<<")"<<"("<<c7<<")"<<"("<<c8<<")"<<"("<<word2<<")"<<"("<<c9<<")"<<"("<<c10<<")"<<"("<<c11<<")"<< std::endl;
}
}