Barring the use of a regular expression library, use repeated attempts at sscanf()...
#include <stdio.h>
int main()
{
const char* param= "1-4,5=12mV,10mv";
int r1_low;
int r1_high;
int r1_vref;
int r2;
int r2_vref;
if (sscanf(param, "%d,%d=%dmV", &r1_low, &r1_high, &r1_vref) == 3)
{
printf("r1: %d-%d / %d mV\n", r1_low, r1_high, r1_vref);
}
else if (sscanf(param, "%d-%d=%dmv", &r1_low, &r1_high, &r1_vref) == 3)
{
printf("r1: %d-%d / %d mV\n", r1_low, r1_high, r1_vref);
}
else if (sscanf(param, "%d-%d,%d=%dmV,%dmv", &r1_low, &r1_high, &r2, &r1_vref, &r2_vref) == 5)
{
printf("r1: %d-%d / %d mV\n", r1_low, r1_high, r1_vref);
printf("r2: %d / %d mV\n", r2, r2_vref);
}
}
Have a play here: https://godbolt.org/z/z3dM1nxdo