const regex = /(?<=says\sto)[\s\S]*?(?=\(\d{4}-\d{2}-\d{2}\s(\d\d:){2}\d{2}\s\w{2}\s\w{3}\))/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?<=says\\sto)[\\s\\S]*?(?=\\(\\d{4}-\\d{2}-\\d{2}\\s(\\d\\d:){2}\\d{2}\\s\\w{2}\\s\\w{3}\\))', 'gm')
const str = `(2021-07-04 11:58:43 PM BST)
---
len wee zim (Tradition (US) ) says to yohan sen
[[:Conversations will be recorded and may be monitored by the participants and
their employers:]] Hi yohan
(2021-07-05 12:04:42 AM BST)
---
len wee zim (Tradition (US) ) says to yohan sen
okay -5 / 0 .
(2021-07-04 11:47:14 PM BST)
---
Ke Cho Ki says to
Hano Cho
hello
(2021-07-05 12:09:41 AM BST)
---
len wee zim (Tradition (Asia)) says
to yohan sen
yes -5 / 0 TN -- / +2.5
---
* * *
Processed by wokl Archive for son malab | 2021-07-05 12:26:44 AM
BST
---`;
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