Windows line endings are:
"\r\n"
The simplest solution is:
if (preg_match ("~<meta name='date' content='(.*)'>\n<meta name='time' content='(.*)'>\n<meta name='venue' content='(.*)'>\n~", file_get_contents($filename), $matches)
||
preg_match("~<meta name='date' content='(.*)'>\r\n<meta name='time' content='(.*)'>\r\n<meta name='venue' content='(.*)'>\r\n~", file_get_contents($filename), $matches))
The correct solution probably is:
if (preg_match("~<meta name='date' content='(.*)'>[\r]?\n<meta name='time' content='(.*)'>[\r]?\n<meta name='venue' content='(.*)'>[\r]?\n~", file_get_contents($filename), $matches))
That said, you probably really should use another method for dealing with HTML & XML. There are parsers built specifically for that.
e.g. http://docs.php.net/manual/en/domdocument.loadhtml.php or http://php.net/manual/en/book.xml.php
On a side note, I haven't really tested either but iirc, they work. Regex is not something I use much.
EDIT:
Seems to work fine?
$file = "iorahgjajgasjgasjgasjgjaagaspokadsfgals<meta name='date' content='(.*)'>\n<meta name='time' content='(.*)'>\n<meta name='venue' content='(.*)'>\niorahgjajgasjgasjgasjgjaagaspokadsfgals";
if (preg_match("~<meta name='date' content='(.*)'>\n<meta name='time' content='(.*)'>\n<meta name='venue' content='(.*)'>\n~", $file, $matches)
|| preg_match ("~<meta name='date' content='(.*)'>\r\n<meta name='time' content='(.*)'>\r\n<meta name='venue' content='(.*)'>\r\n~", file, $matches)) {
echo "Success";
}
else {
echo "Fail";
}
$file = "iorahgjajgasjgasjgasjgjaagaspokadsfgals<meta name='date' content='(.*)'>\r\n<meta name='time' content='(.*)'>\n<meta name='venue' content='(.*)'>\r\niorahgjajgasjgasjgasjgjaagaspokadsfgals";
if (preg_match ("~<meta name='date' content='(.*)'>[\r]?\n<meta name='time' content='(.*)'>[\r]?\n<meta name='venue' content='(.*)'>[\r]?\n~", $file, $matches)) {
echo "Success";
}
else {
echo "Fail";
}