const regex = new RegExp('\\[[^\\]]*\\]\\s*[^\\[]*\\s*\\[[^\\]]*\\]\\([^\\)]*\\):\\s*', '')
const str = `morning lendhu kinda troubles
thatha wanted me to buy cake for him
I went and spent 30 mins extra to get cake
[12:58, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): by the time I got home neighbor came so spoke with him for the first time in 10 years
[12:58, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): thatha spit the cake so I felt a lil bad
[12:59, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): nurse told me don't get cake he'll react negatively
[12:59, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): but I got because I felt it was one of his last and small wish
[12:59, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): so I thought I'll go to office and poop
[12:59, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): but it was late so I went upstairs to poop
[12:59, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): adhukkula pati called me 10 times about why I didn't go to office
[13:00, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): got so mad but controlled myself and went to office
[13:08, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Adhukkula she has called perimma and cried saying he's not taking phone
[13:08, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Within 6 minutes
[13:09, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): And then I came to office adhukkula a meeting got booked (good news) but I need to hire faster and need to be able to pay them consistently (because I'm afraid of losing clients too)
[13:09, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): And then balaji called and I was like I'm a lil worried about u not working on yourself
[13:10, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): And he started crying saying I can't speak normally to you at all I'm lonely
[13:10, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Adhulkula phone got switched off
[13:10, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Now I'm uploading all contacts to CRM to calm down my anxiety and get ready for meetings at 4 and 10:30
[13:10, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Thideer nu somedays are like this stressful and some days are like super peaceful
[13:11, 30/03/2023] Bharadwaj Giridhar from [inboxpirates.net](http://inboxpirates.net/): Then the fight with vaishnav also is kinda bothering me but I don't have the time to talk with her`;
// 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