Untitled
const expr = '/interfaces/interface/bridge-port/priority-regeneration/priority3'; const compareTerm = (term) => { if (expr.includes(term)){ return expr; } }; switch (expr) { case 'Test': console.log('Test1'); break; case compareTerm('/interfaces/interface/bridge-port/priority-regeneration/priority'): console.log('priority',expr); break; default: console.log(`Sorry, we are out of ${expr}.`); }