私はこれを数時間いじっていますが、クラックできないようです。私は基本的に、php の echo (パラメーターなし) に似た js Regexp を作成しようとしています。これがパターンと、私が取得しようとしている値です。
var reg = /echo +[^\s(].+[//"';]/;
'echo "test";'.match(reg); //echo "test";
'echo test'.match(reg); //echo test
'echo "test me out"; dd'.match(reg); //echo "test me out"
'echo "test me out" dd'.match(reg); //echo "test me out"
'echo test;'.match(reg); //echo test;
'echo "test "'.match(reg); //echo "test "
"echo 'test'".match(reg); //echo 'test'
//These should all return null
'echo (test)'.match(reg);
'/echo test'.match(reg);
'"echo test"'.match(reg);
"'echo test'".match(reg);
ここで例を作成しました: http://jsfiddle.net/4HS63/