Since digits are not consecutive, and it contains '_'
too, you need a way to scan them and skip scanning if its neither a digit nor a '_'
Something like this :
char res[15]={'\0'};
if (first != NULL)
{
start = second = first;
while(*second != '\0')
{
if (isdigit(*second))
{
start =second; // Store the start of the "thing"
//Start another loop to check for the "thing"
while(*second != '\0')
if(*second=='_' || isdigit(*second) )
second++;
else
break; //Something else, exit now
break;
}
second++;
start++;
}
}
strncpy ( res, start, second-start ); //Store Result
res[second-start] = '\0';
printf("%s %s\n",find,res);
See HERE