I am trying to get a Match from this string
"Dial [Toll Free 1800 102 8880 ext: 246] to connect to the restaurant. <a class='tooltip' title='Foodiebay has now introduced value added calling features through the website. You just need to dial this number and we ..."
Where I want to check if a variable starts with the string Dial
$a = 'Dial [Toll Free 1800 102 8880 ext: 246] to connect to the restaurant. <a class='tooltip' title='Foodiebay has now introduced value added calling features through the website. You just need to dial this number and we';
preg_match('/[^Dial]/', $a, $matches);
Lose the square brackets:
This matches the string
"Dial "at the start of a line.FYI: Your original regex is an inverted character class
[^...], which matches any character that isn’t in the class. In this case, it will match any character that isn’t ‘D’, ‘i’, ‘a’ or ‘l’. Since almost every line will have at least character that isn’t one of those, almost every line will match.