const regex = /0\R+(.+)\R(?:(?!CDN)(?!^0$)[\s\S])+(?:\RCDN\$\h+(\d+\.\d+))?(?:\RCDN\$\h+(\d+\.\d+))?\R(?:(?!^0$)[\s\S])+/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('0\\R+(.+)\\R(?:(?!CDN)(?!^0$)[\\s\\S])+(?:\\RCDN\\$\\h+(\\d+\\.\\d+))?(?:\\RCDN\\$\\h+(\\d+\\.\\d+))?\\R(?:(?!^0$)[\\s\\S])+', 'gm')
const str = `
0
South Park™: The Stick of Truth™
OVERALL REVIEWS:
OVERWHELMINGLY POSITIVE
RELEASE DATE:
3 MAR, 2014
-75%
CDN\$ 39.99
CDN\$ 9.99
Add to Cart
RPGComedyAdventureFunnyTurn-Based
Added on 8/9/2020 ( remove )
0
Grand Theft Auto V
OVERALL REVIEWS:
VERY POSITIVE
RELEASE DATE:
13 APR, 2015
View Details
Open WorldActionMultiplayerAutomobile SimCrime
Added on 1/15/2020 ( remove )
0
System Shock
OVERALL REVIEWS:
NO USER REVIEWS
RELEASE DATE:
SUMMER 2021
CDN\$ 51.49
Add to Cart
ActionAdventureCyberpunkSci-fiImmersive Sim
Added on 6/9/2020 ( remove )
`;
const subst = `$1 $2 $3\n`;
// 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