Thanks again for this answer. I modified your regex a bit in order to work correctly with the libreoffice regex function. I added .*
twice, at the beginning and at the end of the regex.
With blah blahTESTblab la14blah-15S rebla
in cell A1
:
=REGEX(A1;"(?i)(TEST)(?:.*(\d{1,2}S)|)";"★$1$2")
gives blah blah★TEST15S rebla
=REGEX(A1;"(?i).*(TEST)(?:.*(\d{1,2}S)|).*";"★$1$2")
gives ★TEST15S