I would like to use regex to match string tofind
I have two options: 1st
before tofind
Te second -
tofind after
How to combine the word tofind in two examples with one regular line?
I used
before (tofind) | (tofind) after
He gave them in match 1 and in match 2
I would always get the result in match 1
I am using php:
if (preg_match("/before (tofind) | (tofind) after/", $content, $result))
return trim($result[1]);
Thank you
source
share