Im using the preg_match to find a certain word in a text file. However, I want to define the starting line from which preg_match starts its search. How can I make preg_match to ignore the first 5 lines? Additionally, I have a code which will automatically delete the preg_matched word from the file, so im not sure a "start from keyword" would work here.
Heres the code im using.
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/\b$pattern\b/m";
if(preg_match_all($pattern, $contents, $matches))