I need to get substrings from all text before ánd after two possible words. These words are “at” and “by”.
So when I have the following string:
“Hello this is a text by Piet”
NewVariable1: “Hello this is a text”
But “by” is sometimes “at”. For this, I can build an if statement of course. But since I already have I few if statements in this bot I hope I can fix this with a regex for example. Does anybody know how to solve this problem? Would really appreciate it!