int main()
{
   regex_t preg;
   regmatch_t substmatch[1];
   const char *tp = ;
   const char *t1 = ;
   const char *t2 = ;
   const char *ss = ;

   regcomp(&preg, , REG_EXTENDED);
   printf(, t1,
                                        (regexec(&preg, t1, 0, NULL, 0)==0) ?  : , tp);
   printf(, t2,
                                        (regexec(&preg, t2, 0, NULL, 0)==0) ?  : , tp);
   regfree(&preg);
   
   regcomp(&preg, , REG_EXTENDED);
   if ( regexec(&preg, t1, 1, substmatch, 0) == 0 )
   {
      
      char *ns = malloc(substmatch[0].rm_so + 1 + strlen(ss) +
                        (strlen(t1) - substmatch[0].rm_eo) + 2);
      memcpy(ns, t1, substmatch[0].rm_so+1);
      memcpy(&ns[substmatch[0].rm_so], ss, strlen(ss));
      memcpy(&ns[substmatch[0].rm_so+strlen(ss)], &t1[substmatch[0].rm_eo],
                strlen(&t1[substmatch[0].rm_eo]));
      ns[ substmatch[0].rm_so + strlen(ss) +
          strlen(&t1[substmatch[0].rm_eo]) ] = 0;
      printf(, ns);
      free(ns); 
   } else {
      printf(, t1);
   }
   regfree(&preg);

   return 0;
}