$text="fhdsklf sdoijf ds <h1>jfidsfj</h1> jklsfdjflks";
$pattern ="!<h1>.+</h1>!";
preg_match($text, $pattern, $matches);
print_r($matches);
$text="fhdsklf sdoijf ds <h1>jfidsfj</h1> jklsfdjflks";
$pattern ="!<h1>.+?</h1>!";
preg_match($pattern, $text, $matches);
print_r($matches);
preg_match($text, $pattern, $matches);
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )