hi everyone i am new in php and i want to serch the specific words on text file using pregmach .
i have try the patterns of the pregmatch() but it seems like i dont doit right.
can someone look into my code and help me out with this problem.
$q=$_POST;
$jaar=$_POST;
$num= $_POST;
echo $court."<br />";
$mn=$_POST;
echo $mnc."<br />";
$toSearch = "[".$jaar."]"." ".$name." ".$mn;
echo $toSearch."<br />";
$file =$q."file1.txt";
$lines = file($file);
$count;
$lineNumbers;
if ($lines)
{
foreach($lines as $lineNumber)
{
$lineNumbers++;
$foundAMatch = preg_match("/[A-Za-z_0-9]$toSearch\b/i", $lineNumber, $matches, PREG_OFFSET_CAPTURE);
if ($foundAMatch > 0)
{
echo $foundAMatch."<br />";
$found = $matches[0][0];
$count=$lineNumber;
echo $lineNumber."<br />";
write($lineNumbers,$lineNumber);
}
}
//$str_array = explode(" ",$count);
//echo $str_array[0]."<br/>";
}
else
{
$line="no file/folder found";
echo $line;
}