<?php
$string = 'Writing to tell you that var MyCode = "dentline"; Learn it.';
$matches = array();
preg_match('/var MyCode = "(.*?)";/', $string, $matches);
echo $matches[1];
?>