Henning
10/16/2013 5:55:00 PM
"MM" <kylix_is@yahoo.co.uk> skrev i meddelandet
news:1lht591evkhdnfdt5sd16e2boe2k4u8eii@4ax.com...
> On Wed, 16 Oct 2013 17:34:28 +0100, Deanna Earley
> <dee.earley@icode.co.uk> wrote:
>
>>On 16/10/2013 17:11, MM wrote:
>>> Text strings are what's being filtered.
>>>
>>> What I want is to filter for (A AND B) OR (C AND D) or maybe
>>> (A AND B AND C) OR D
>>>
>>> What's the best way to approach this? Regular expressions?
>>
>>Filter in what way?
>>
>>If (Instr(blah, "A") > 0 And Instr(blah, "B") > 0) or (Instr(blah, "C")
>> > 0 And Instr(blah, "D") > 0) Then
>
> But I might only have a simple filter:
> If A AND B...
>
> or If A OR B...
>
> as well as any combination of compound filters using parentheses. I
> can hardly have a whole bunch of different If (Instr(blah, "A") > )...
> etc statements, and you can't change the If statement at runtime
> (although I recall reading years ago that some add-in or something
> allowed the programmer to create on-the-fly code changes at runtime).
>
> What I need is *one* section of code that will deal with every
> eventuality, including, later, NOT tests combined with AND and OR,
> with/without parentheses depending on what filtering I needed.
>
> So, for example, let's assume the text contains:
> "ben walked to the end of the road to meet sally, but bill was there"
>
> I might want to filter using the following criteria:
>
> Only include record if "ben" is present.
> Only include record if "sally" or "bill" is present.
> Only include record if "road" and "bill" are present.
> and so on.
>
> The above text is short, but in practice it might be several lines
> long and the filters might run to 10 or more, coupled with any
> combination of AND, OR, or NOT, plus parentheses where necessary.
>
> Note: I don't need to find *where* a word/substring is in the text;
> just that it is present or absent.
>
>>You can split it up into individual temporary variables or separate
>>checks depending on the exact structure and what it's doing.
>
> MM
Separate Functions for each combination of criteria...
/Henning