$text = 'ignore everything except this {{ text1 }}'; preg_match('#{{(.*?)}}#', $text, $match); var_dump($match);