const regex = new RegExp('(?<=\\.mdm\\.[a-z0-9_.]{0,100})_', 'gm')
const str = ` ips.mdm.table1_a
ips.mdm.table2_a_b
ips.mdm.table3_a
ips.mdm.table4_a_b_c
ips.mdm.table5.a_b
ips.mdm.table6_a_b_c`;
const subst = `-`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions