Pages: 1
RSS
How filtering rules work exactly
 
Hello,

I'm playing with sorting office filters and can't seem to understand how filter conditions exactly work.

Specifically, what's the difference between conditions:
contains
match
contains any of
matches any of
matches all as regexp

For instance how to match "pill" but not "pillow" or "spill" ?

Also as I read it's possible to check for many strings at once by separating them with a pipe | character - if so, what's the difference between
Subject -> match -> word1|word2
and
Subject -> matches any of -> word1|word2
Also how to separate regexes, where | has a special meaning?

I know I can find the answers by testing, but guess someone did it already and may share his knowledge.
Or maybe there is a tutorial on this somewhere?

Thanks
 
Peter,  

I raised a support ticket last week asking the same question.

I got the following reply:
"The above mentioned conditions are all bound to regular expressions. Once you learn how to use regexps you will be able to make use one of these conditions.

If you have any other questions I will be glad to assist you."

I replied satying I know RegEx and could I have a specific example of how to use contains / contains any. No reponse as yet - if/when I get one I'll post it here.

Graham
 
Visit this site for a tutorial on Regex
www.regular-expressions.info/tutorial.html

O'Reilly does have one book out can be found on Amazon/Chapters websites.
Title: Mastering Regular Expressions
ISBN 1-56592-257-3
 
well I know how to create regular expressions and have lots of tutorials on the subject, but my question was not at all about that. I just want to know what's the difference between these five filtering conditions.

Now I know directly from the official source what's common - that they are "all bound to regular expressions" :)
What a surprise!

The Ritlabs support answer posted by Graham can hardly be less informative, but at least saved me some time for creating a ticket with the same question.

If Ritlabs can't answer this, someone else please?
 
There is an excellent tutorial on the TBFAQ WebSite on the subject of filtering. The screen shots are fr om v2 and things look a fair bit different, but what it has to say about filtering strings is interesting and still pertains.

The RITlabs answer was, indeed, misleading. Only 'Matches all as regexp' uses proper regex. The rest used TB's own string matching logic, which is a little regular, but isn't truly regex. Ok, this may have changed and the regex engine is now used throughout, but my old filters still work, so ...

Fr om the FAQ on Filtering:
Quote

Square brackets surrounding a string mean that TB is to treat it as a string literal. This means that for a match string of [Re:] Re: will be true, but Re:do will be false. A better explanation would be [cat], wh ere cat would be true, but cats, catatonic, and catalyst would be false.

Pipe characters ( usually SHFT-\ ) allow you to OR strings within a single rule set. In our above example, you could put [cat] | [cats] | [kat] | [katz] | [catz] on a single line. This allows you to group ORs without creating a long list of filter sets wh ere you have to scroll up and down to see them all. This can be done on the ALTERNATIVES tab as well as the RULE tab.

The double-quotes are used to make a case-sensitive match. So putting "cat" would match "cat", "catatonic", and "catalyst", but not "Cat", "caT", or "Cathy".

The above brings up an important point. What if you want to do a case-sensitive sting literal match for just the word "cat". To do this, you'll need to enclose the entire string in single-quotes. i.e. '[cat]'.

This may or may not help ;)
iviarck
 
Thanks Marck,

this brings some clarity.
As I understand it, square brackets mean we're looking for a whole word only, so [cat] is equivalent to the regex \bcat\b and will not match the string as a part of a word, like in cats.

So far so good, but it's still a mystery what's the difference between "contains" and "match" conditions, as well as between "contains" and "contains any of"
 
We're down to educated guesses here.

I think "contains" means anywhere within the specified field while "match" means the specified field must completely match. "Contains any of" may just be a simple way for the RegEx shy to put in a space separated list of strings to be looked for within the field data.
iviarck
Pages: 1