Hello Jaroslav,
> Hello Jesse,
>
>>> 1. check if the string does NOT contain a word
>>> 2. check the same as 1. but for reverse word
>> You can use a negative look ahead for that:
>>
>> ^((?!nottheword|drowehtton).)*$
>>
> Thanks a lot. That's exactly what I was looking for in case of 1.
>
> Is there a way to reverse "nottheword" using regex? For instance,
> there is some /reverse option in Perl. I don't know too much about it,
> I just saw it some time ago. Is it possible in .NET?
No there is no such option. There is a RegexOptions.RightToLeft, but that
tries to find teh given pattern from the back of the string going to the
front instead of the other wat around. The pattern itself is still LeftToRight.
I'm not sure, but my guess is that the Perl reverse option is similar to
the .NET one.
There's a nice discussion on string.reverse functions here:
http://weblogs.sqlteam.com/mladenp/a...3/19/9350.aspx
And if you're using .NET 3.5, you could write an extension method for string
to make it more logical.
> PS. I know that joe and joe+ are same - that was my mistake ;-) Anyhow
> thank you...
the pattern 'joe' and 'joe+' are certainly not the same, that was what I
was trying to tell you.
Where 'joe' would only match 'joe'; 'joe+' would also match 'joeeeeeeeeee'.
--
Jesse Houwing
jesse.houwing at sogeti.nl