YSITD_TG_Bot says to #ysitd <seadog007>: $re = '/test(.*?)ab(.*?)cd/'; $str = 'testhelloworldabhihicd'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); var_dump($matches);