The preg_match grabs the parameters of the <embed> tag
It looks for <embed and then grabs everything that is not >
I assume you want JS to echo the <embed ...></embed> to grab this, use
preg_match( "/<embed .*<\/embed>/i" , $string , $matches );
The i makes it case insensitive