const regex = new RegExp('([A-Z]{3})(?:.*?)([A-Z]{3})(?:.*?)((\\d{1,2}\\/\\d{1,2}\\/\\d{4})|(\\d{1,2}(?:.*?)(January|February|March|April|May|June|July|August|September|October|December)( (\\d{4}))?)|(\\d{1,2}(?:.*?)(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)( (\\d{4}))?))', 'g')
const str = `TRZ dupa dupa dupa siurak KFR GTB GTT TGH 5 10 15 20:30 5/12/2587
dupa KGB TRZ dupa siurak KFR GTB 5 Jan ssdsdsdsd
dupa KGB TRZ dupa siurak KFR GTB 5 Jan 1235
dupa KGB TRZ dupa siurak KFR GTB 5 January sdsdsdsd
dupa KGB TRZ dupa siurak KFR GTB 5 January 2315`;
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