const regex = /^(?:Play3|One|Hero12|\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\d{4}\b)$(*SKIP)(*F)|(?<![\d,])(?![0,]*$)(?:0*\K(?:\d{1,3}(?:,\d{3})+|\d{1,4}))$/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(?:Play3|One|Hero12|\\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\d{4}\\b)$(*SKIP)(*F)|(?<![\\d,])(?![0,]*$)(?:0*\\K(?:\\d{1,3}(?:,\\d{3})+|\\d{1,4}))$', 'gm')
const str = `Play3
1,715,455
123,777
One
23,000
etet55
Hero12
vrtg1,345
vrtg001,345
2
Jan2003
0000
0001
12345
45,77
45,777
045,777
Jan2003
03,1
0,1
0,000
0,001
`;
const subst = `\n$0`;
// 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