Teo,
>>Does dog have to precede cat or can it follow cat?
this is not important now, both the cases are good
(anyway if there is a way or parameter
to set the precedence it will be surely useful in the future...)
setting the precedence generally means you doubled the number of expressions
as now you need:
MyString = "(dog AND cat) OR (cat AND dog)"
>>What about interleaving characters?
what do you mean with 'interleaving' characters?
I never met this word (I'm Italian)
It means characters between the words.
In other words would "I had milk in my coffe" or "it rained cats and dogs"
match?
AND is simply listing the characters:
dogcat
However that says there are no interleaving characters (no characters)
between the words.
To introduce interleaving characters you need:
dog.*cat
or
dog.+cat
The first says dog followed by any character zero or more times followed by
cat. While the second says dog followed by any character one or more times.
Instead of . I would consider \s which says white space.
OR is simply alternation:
dog|milk
Will match a string with dog it in or milk in it.
You should be able to use a string such as (untested):
MyString = (dog.*cat)|(cat.*dog)|(milk.*coffe)|(coffe.*milk)
--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"teo" <te*@inwind.itwrote in message
news:9t********************************@4ax.com...
teo,
>>MyString = "(dog AND cat) OR (milk AND coffe)"
Are you saying you want to find both dog & cat in a string or both milk &
coffe in a string?
that's right
>>Does dog have to precede cat or can it follow cat?
this is not important now, both the cases are good
(anyway if there is a way or parameter
to set the precedence it will be surely useful in the future...)
>>What about interleaving characters?
what do you mean with 'interleaving' characters?
I never met this word (I'm Italian)
>>Some RegEx resources:
Thanks, I previously went deep on MSDN fx 2.0
and on the renowed VBNet book by F.Balena,
and on the shareware version of 'RegEx Buddy '
(Now REgExBuddy is expired so I'll go with Expresso )
but found tons of samples about one or more chars,
but NO sample about one or more words and their AND or OR
boolean evaluation
(I met only the OR operand like dog|cat ,
but it is not my case)
The implementation of that simple boolean evaluation
like (dog AND cat) OR (milk AND coffe)
still remains...
(maybe the interleaving chars could help,
but what are those? )