Hello everyone,
I guess I need some help to build a boolean-like regular expression using preg_match_all ($boolean-like-expression,$text,$matches).
Given that
$text: is a given text (say a web page containing an article on house gardening)
$matches is the returned array of keywords found
$boolean-like-expression: is a user defined set of keywords (say \'house AND garden\') to be matched against the $text content.
So far I was only capable to get the OR operator working by using the alternate pattern separator \'|\' in a expression like:
$boolean-like-expression:\"/\bhouse\b|\bgarden\b/i\";
(Will return true if the word house OR the word garden is found)
But more complex searches like \'word1 AND word2\' or \'(word1 AND word2) OR word3\' seam to be impossible using PCRE
Can someone advise me on that? I must say I am not so good in Perl regular expressions but I have the feeling that I will need to use a database to search with boolean operators.
Vin