Hi David,
I've seen this topic : Can't get "Drop Record If Not RegExp" filter to work
http://www.pricetapestry.com/node/2956 dated on 2009.
I want to filter a feed holding 14.000+ records, by taking only two items in the category.
It's all about medical products, but with uppercase and lowercase like this : Afslanken Gezondheid
Without the Regexcode for Case Insensitive it won't work.
In the meantime I would suggest to change in filter.php the lines 218 and 290 from :
$filter_dropRecordFlag = !preg_match($filter_data["text"],$text); // 218 without exclamationsign !
to
$filter_dropRecordFlag = !preg_match($filter_data["text"],strtolower($text));
It works, but one has to keep in mind the use of lowercase in keywords.
In this case 4724 products instead of 14.485 , the larger part is not relevant for the website.
Changing the preg-match would be better, but that is working deeper into the total filter.
Best regards,
Ruud
Hello Ruud,
Changing the code as you have done to make the match case-insensitive is probably the better solution rather than having to remember to enter your match as a full regular expression with "i" modified (e.g. "/Afslanken Gezondheid/i")
You could go one step further and strtolower() both parts - that way you don't need to remember to use all lower case when setting up your filters - so in includes/filter.php look for the following code at line 218:
$filter_dropRecordFlag = preg_match($filter_data["text"],$text);
...and REPLACE with:
$filter_dropRecordFlag = preg_match(strtolower($filter_data["text"]),strtolower($text));
...and then the following code at line 290:
$filter_dropRecordFlag = !preg_match($filter_data["text"],$text);
...and REPLACE with:
$filter_dropRecordFlag = !preg_match(strtolower($filter_data["text"]),strtolower($text));
That will make Drop Record RegExp and Drop Record If Not RegExp case-insensitive without having to use modifiers...
Cheers,
David.
--
PriceTapestry.com