i want to match a title from imdb sites. i test online the pattern regex http://regex101.com. its match and return the title but in PHP no result, no error. what's wrong by the way?
<?php
$imdb = file_get_contents('http://www.imdb.com/title/tt4600952/?ref_=nv_sr_1');
$sourcecode = htmlentities($imdb);
preg_match('/<h1 itemprop="name" class="">([a-zA-Z0-9\:\'\ ]+)/', $sourcecode, $title);
var_dump($title);
?>
([a-zA-Z0-9\:\'\\\ ]+)/` your missing 2 \\ backslashes it takes 3 backslashes ( 1 for PECL, 1 for PHP and the original) to do a backslash. regx101.com doesn't account for this issue. Not sure if it will make a difference though.
– ArtisticPhoenix Mar 31 '18 at 18:10