Hello,
I have a datafeed and I want to validate each row against a varying set of keywords some exact some broad and some negative exact and negative broad if that makes any sense ultimatley these will be stored in a database and be feed specific.
here an example of what i mean lets say I am look for PC's I don't want software furnature Apple Macs or accessories I have already applied a price range filter
$exact = array(
0 => "Dell inspiron 9200",
1 => "IBM Thinkpad",
2 => "Acer aspire 500"
);
$broad = array(
0 => "Computer",
1 => "Desktop",
2 => "PC",
3 => "Laptop",
4 => "Notebook"
);
$neqexact = array(
0 => "Apple",
1 => "iMac",
2 => "MacPro"
);
$negbroad = array(
0 => "Apple",
1 => "Mac"
);
// example func (** Doesn't work) \\
function exact_match($find,$data){
$find = explode("|",$find);
for($i=0;$i<sizeof($find);$i++){
if(preg_match("/\b".$find[$i]."\b/i", $data)){
return true;
}else{
return false;
}
}
}
// I have left out the other func as it is pretty much the same without \b \b
// **START DATA FEED LOOP{
if(exact_match($exact,$data[0]) && broad_match($broad,$data[0]) && !exact_match($negexact,$data[0]) && !broad_match($negbroad,$data[0])){
// ** DO SOMTHING WITH GOOD DATA ** \\
}
// ** END FEED LOOP }