const regex = new RegExp('^.*[a-z]{2}_[a-z]{2}(/[^/]+\\.\\w+)$', 'gm')
const str = `www.company.com/pl_pl/company/contact/thank-you/dl/7011o000003pohk/msp/ttt/doc/whitepapers/pl_pl/whitepaper.pdf`;
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