const regex = /(?=_{20,}|From:|On\s\w{3},\s\w{3}\s\d{1,2},\s\d{4}\sat\s\d{1,2}:\d{2})/i;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?=_{20,}|From:|On\\s\\w{3},\\s\\w{3}\\s\\d{1,2},\\s\\d{4}\\sat\\s\\d{1,2}:\\d{2})', 'i')
const str = `Great thank you
________________________________
From: Blake <blake@foursocial.uk>
Sent: Saturday, August 31, 2024 9:46:12 AM
To: blake hoang <bjh2004@hotmail.co.uk>
Subject: Re: Ignition. Campaign
Thanks , yes we can do it
---
Blake Junior
Managing Director | Foursocial.
blake@foursocial.uk<mailto:blake@foursocial.uk>
Submission Links<https://linktr.ee/foursocial1>
[https://ci3.googleusercontent.com/mail-sig/AIorK4yeSFbHM5imdVzOjDTr7LwNvS9gqpyQ83uajylr7mDBuRn5ymG1jlev6Zz8vvgQMzDLAYjFLcR7LVLu]
On Sat, Aug 31, 2024 at 9:45 AM blake hoang <bjh2004@hotmail.co.uk<mailto:bjh2004@hotmail.co.uk>> wrote:
Hey there let me know the fee`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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