re = /(?<=says\sto)[\s\S]*?(?=\(\d{4}-\d{2}-\d{2}\s(\d\d:){2}\d{2}\s\w{2}\s\w{3}\))/m
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
---'
subst = ''
result = str.gsub(re, subst)
# Print the result of the substitution
puts 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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html