There is no regex for searching for a particular type of formula in a sheet from a macro perspective. Instead, if you want to retain specific formulas but not others, you will need to inspect each cell with a formula and determine if it is one you want to serialize vs one you want to keep. Then if it is one you want to serialize, read the values from the source sheet and write them to the copy:
function copyFormulasAndSomeValues() {
var source = SpreadsheetApp.getActive(). getActiveSheet();
var remote = SpreadsheetApp.openById("some ID");
// Copy all static values and formulas (and charts, formatting, etc.)
var dest = source.copyTo(remote);
// To efficiently read and write values when we know nothing
// about the structure of invalid formulas, we will use a RangeList.
// If structure exists (e.g. if a1 is invalid we know `A2:A100` will be too), we can combine batch
// get/set methods with the 4 parameter getRange() method.
var toRead = [];
// Read in all formulas on the created sheet (no formula appears as "" e.g. nullstring).
var formulas = copy.getDataRange().getFormulas();
formulas.forEach(function (row, r) {
row.forEach(function (formula, c, rowData) {
if (!formula) return;
// Check if this is a formula we want to replace.
if (/* your tests here */) {
// Store R1C1 notation for later reading.
toRead.push(String(r + 1) + String(c + 1));
}
}); // End column value checking
}); // End sheet row checking
// If all formulas checked out, quit.
if (toRead.length === 0)
return;
// Read desired values into a RangeList.
var rangeList = source.getRangeList(toRead);
var toWrite = rangeList.getRanges().map(function (range) {
return range.getValue();
});
// Write to the same regions in the destination.
dest.getRangeList(toRead).getRanges().forEach(function (range, i) {
range.setValue(toWrite[i]);
});
}
If you know the structure/arrangement of what will be valid / invalid, you will be able to improve this method by batch-reading a batch-writing the static values.