const testString = 'Schlafsack';
const schlaf = /(?:Schlaf)?/gm;
const sack = /(?:sack)?/gm;
if (testString.match(schlaf)) {
console.log(`${schlaf} found!`);
}
if (testString.match(sack)) {
console.log(`${sack} found!`);
}
> node ./app.js
/(?:Schlaf)?/gm found!
/(?:sack)?/gm found!