const regex = /model: ([^\n]+)(.*)bitmap [^\n]+/gms;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('model: ([^\\n]+)(.*)bitmap [^\\n]+', 'gms')
const str = `# model: pmy0_footr015
filedependancy Unknown
newmodel pmy0_footr015
setsupermodel pmy0_footr015 NULL
classification Character
setanimationscale 1.0
beginmodelgeom pmy0_footr015
node dummy pmy0_footr015
parent NULL
endnode
node trimesh pmy0_footr015g
parent pmy0_footr015
position 0.0 0.0 0.0
orientation 1.0 0.0 0.0 0.0
bitmap pmh0_footr050
verts 15
-0.0378169 -0.00381612 0.00857995`;
const subst = `model: $1$2bitmap $1`;
// 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