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['path'];
$jaar=$_POST['years']; $num= $_POST['name']; echo $court.""; $mn=$_POST['mnumber']; echo $mnc.""; $toSearch = "[".$jaar."]"." ".$name." ".$mn; echo $toSearch."";
$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."";
$found = $matches[0][0];
$count=$lineNumber; echo $lineNumber.""; write($lineNumbers,$lineNumber);
}
//$str_array = explode(" ",$count);
//echo $str_array[0]."";
else
$line="no file/folder found";
echo $line;
i dont know deeply.. use array_search();
it dosent work i have try it before,sorry i didi'nt gve you the structure of my file.
"2005_32.rtf" (23 ) S v Manqaba [2005] simon 45 ; "2005_33.rtf" (24) Simon v Manqaba [2005] Dan 46 ;
basically i want to search this [2005] name number