Help with filters

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: Help with filters

Postby JustAMacUser » 10 Jul 2015, 02:42

I've found the biggest thing to keep in mind with the filters is that the Test button runs a database query with regular expressions, whereas when the feed is being processed the filter is run in PHP with preg_match. With the Test button the source content (from the feed) is not database escaped whereas preg_match checks your filter against the feed's content (title, author, whatever) after it's been escaped for the database. So something like this in the feed:

Code: Select all

This is the post's sample code.


With the filter:

Code: Select all

post's sample


Would match during a test, but during feed processing would not. It gets more tricky because PostgreSQL and MySQL escape differently. In PostgreSQL you'd need something like:

Code: Select all

post''s sample


And MySQL:

Code: Select all

post\\'s sample


I didn't test these specifically, but you get the idea.

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 03 Aug 2015, 02:18

I've got one more question about this, is it possible to filter a specific ascii character using it's HTML code: ►?

Mostly I'm wondering if any special format is required.. I'm going to try it now and see what happens.

UPDATE:
I've tried (►) and (\\&\\#9658\\;) but neither seems to work.. It occurs to me that # is probably not escaped, so I'm trying (\\&#9658\\;) next.

UPDATE:
(\\&#9658\\;) doesn't work, and neither does (\\&#9658). I am stumped, any help is appreciated.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Help with filters

Postby fox » 03 Aug 2015, 08:15

I might be wrong but I don't think that is supported by preg_match().

pcause
Bear Rating Master
Bear Rating Master
Posts: 144
Joined: 23 Aug 2013, 19:52

Re: Help with filters

Postby pcause » 03 Aug 2015, 15:15

There are a number of PHP online regex testers you can use to try to try to figure out the regex you need. These allow you to focus on the regex and test text and figure things out. Here is an example:

http://www.pagecolumn.com/tool/pregtest.htm

use PCRE and preg_match

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 04 Aug 2015, 01:09

Tried that site, and it seems (►) should work. In fact it seems it was catching some but not all. If I combined it with other searches (►|whatever|also|blah) that seemed less effective.

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: Help with filters

Postby JustAMacUser » 04 Aug 2015, 04:07

Just in case there's confusion, while your browser will translate HTML entities into their respective characters, preg_* has no understanding of such. So if the source is using the character code, or named entity, or actual character; they will all be different for preg_match and you'll have to build your pattern to account for all of the variations.

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 09 Aug 2015, 09:12

I used what I found in 'view source', but it still doesnt seem to be matching all of the relevant posts. But it seems like it might be matching some.

Is it wrong to put searches in like (this|that|theother)?

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 08 Sep 2015, 02:20

Hi, I'm still having weird problems with this, for example I've got a really simple filter, it searches posts for the word 'freelancegigs' in title or content and deletes the post, but it's not working.. I'm seeing posts with freelancegigs.biz in their content. What am I doing wrong? :/

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: Help with filters

Postby JustAMacUser » 08 Sep 2015, 03:20

Is it not working for some or all of the articles?

When clicking the Test button when editing the filter, are the displayed results accurate?

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 09 Sep 2015, 04:27

Huh, when I click 'test' it says 'an error occured'. I guess I had too many rules and it was breaking the filter.

I've trimmed it to only 6 rules and I'll see if they all start working now. Thanks for your help!

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 09 Sep 2015, 05:11

It is not working. The filter should spot anything with 'freelancegigs' in the content but something with freelancegigs.work slipped through repeatedly.

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: Help with filters

Postby JustAMacUser » 09 Sep 2015, 05:22

You mentioned you had several rules, do you have the filter set to match any or all the rules?

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 09 Sep 2015, 05:36

It's set to match any rule, and this particular filter is at the top of the list.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Help with filters

Postby fox » 09 Sep 2015, 08:04

SimbaLion wrote: I guess I had too many rules and it was breaking the filter.


no

SimbaLion
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 07 Jul 2015, 02:04

Re: Help with filters

Postby SimbaLion » 09 Sep 2015, 10:01

fox wrote:
SimbaLion wrote: I guess I had too many rules and it was breaking the filter.


no


Can you tell me what I'm doing wrong?


Return to “Support”

Who is online

Users browsing this forum: No registered users and 9 guests