I want to retrieve a substring out of a other string.
The beginning of the string has 2 possibilities. Let's say 'abc' or 'def'
After this string there is a ' character and a random word. After the word there is a colon and then a sentence. And at least the string ends with a ' again.
So some possibilities are:
abc 'randomword: my sentence'
def 'otherrandomword: my other sentence'
my other sentence
preg_match("/((\babc\b)|(\bdef\b)) '[a-zA-Z]+: (.*?)'/", $your_string, $matches); var_dump($matches);