const regex = /^Name:(?:(?!Name:|-).)+-\d+ Days(?:(?!Name:|-).)+(?=Name:|\z)/gms;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^Name:(?:(?!Name:|-).)+-\\d+ Days(?:(?!Name:|-).)+(?=Name:|\\z)', 'gms')
const str = `Name: John Smith
Address: 123 Sample Road
Country: England
Membership Expires: January 26, 2023, 9:35 am -288 Days
Plan: Platinum
Payment Method: American Express
Name: Paul Mitchell
Address: 911 Unknown Road Country: USA
Membership Expires: October 7, 2024, 10:23 am 331 Days
Plan: Gold
Payment Method: Visa
Name: David Beckham
Address: 666 Example Road
Country: Scotland
Membership Expires: August 30, 2023, 6:03 pm -72 Days
Plan: Silver
Payment Method: Mastercard
Name: Frank Bruno
Address: 999 Random Road
Country: France
Membership Expires: April 19, 2024, 10:41 pm 160 Days
Plan: Bronze
Payment Method: PayPal
`;
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