AND and OR with expressions
-
http://www.albahari.com/nutshell/predicatebuilder.html[^] I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) :) I have a class like this:
public class SearchWord { ... public string Search\_key { get; set; } public string And\_key { get; set; } public string Not\_key { get; set; } ... ... }
SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin"; there are 4 case for my situation: test = returns bool test and email = returns bool test and engin = returns bool test and email and engin = returns bool Now, I want to compare this 4 result and return SearchWord(if result = true) Please help me...
-
http://www.albahari.com/nutshell/predicatebuilder.html[^] I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) :) I have a class like this:
public class SearchWord { ... public string Search\_key { get; set; } public string And\_key { get; set; } public string Not\_key { get; set; } ... ... }
SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin"; there are 4 case for my situation: test = returns bool test and email = returns bool test and engin = returns bool test and email and engin = returns bool Now, I want to compare this 4 result and return SearchWord(if result = true) Please help me...
enginço wrote:
please don't say REGEX
Uhmmmmmmm...
Regex
? :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
enginço wrote:
please don't say REGEX
Uhmmmmmmm...
Regex
? :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]