I am learning a new language and I have created a DB with aprox. 2500 words and 2500 examples of the words. I created a PHP/MySQL web UI with basically shows pictures for each
Is this what are you looking for?
(\b(pre1|pre2)?WORD(suf1|suf2)?\b)
Online demo
If you are looking for whole line as a match then try below regex and get if from matched group at index 1
(.*(\b(pre1|pre2)?WORD(suf1|suf2)?\b).*)
Use preg_match_all to get all the matched groups.
preg_match_all