how do you know (A AND B) belongs in the AND group? There is no AND or NOT in front of it. Have you tried any code yet we can look at? (he asks for the second time).
Hi Kevin,
suppose my query is like this:-
((A AND B) NOT (C AND D) AND (M AND N) NOT (P OR Q))
i tried like this:-
-
if($query=~/(.*)\sNOT\s\(([^()]+)\)(.*)/g)
-
{
-
$key=$1;
-
$sec=$2;
-
$third=$3;
-
print "<br>first =$key<br>";
-
print "<br>second=$sec<br>";
-
print "<br>third=$third<br>";
-
$final=$key."".$third;
-
print "<br>****final value=$final<br>";
-
if($final=~/(.*)\sNOT\s\(([^()]+)\)(.*)/)
-
{
-
$term=$1;
-
$sterm=$2;
-
$lterm=$3;
-
print "< br>TERM=**************$1**<br>";
-
print "<br>STERM=******$2<br>";
-
print "<br>LTERM=*****$3<br>";
-
}
-
}
-
i.e first i have used regular expression to filter NOT terms
i have stored the terms in $1, $2& $3
and check again if it has NOT terms then again store $1,$2....
But if many NOT terms this will not work.