#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?ms)^Name:(?:(?!Name:|-).)+-\d+ Days(?:(?!Name:|-).)+(?=Name:|\z)"
Local $sString = "Name: John Smith" & @CRLF & _
"Address: 123 Sample Road" & @CRLF & _
"Country: England" & @CRLF & _
"Membership Expires: January 26, 2023, 9:35 am -288 Days" & @CRLF & _
"Plan: Platinum" & @CRLF & _
"Payment Method: American Express" & @CRLF & _
"Name: Paul Mitchell" & @CRLF & _
"Address: 911 Unknown Road Country: USA" & @CRLF & _
"Membership Expires: October 7, 2024, 10:23 am 331 Days" & @CRLF & _
"Plan: Gold" & @CRLF & _
"Payment Method: Visa" & @CRLF & _
"Name: David Beckham" & @CRLF & _
"Address: 666 Example Road" & @CRLF & _
"Country: Scotland" & @CRLF & _
"Membership Expires: August 30, 2023, 6:03 pm -72 Days" & @CRLF & _
"Plan: Silver" & @CRLF & _
"Payment Method: Mastercard" & @CRLF & _
"Name: Frank Bruno" & @CRLF & _
"Address: 999 Random Road" & @CRLF & _
"Country: France" & @CRLF & _
"Membership Expires: April 19, 2024, 10:41 pm 160 Days" & @CRLF & _
"Plan: Bronze" & @CRLF & _
"Payment Method: PayPal" & @CRLF & _
""
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm