<?php $text = "document.write('1234567895.0.'.substr(8) + '219.100');"; preg_match("#document.write\('(.*?)'.substr\((.*?)\) \+ '(.*?)'#si",$text,$return); unset($return[0]); print_r($return);