Well, lets take an example, you have a web site and the people come to your site from a search engin (Google, Bing) and now you want to know which word are used for the search and which search engin are used as well.
public string GetSearchKeyWords(string strQuery)
{
string result = "";
string pattern = "\\b\\w*p=(?!u)\\w*\\b|\\b\\w*q=(?!u)\\w*\\b|\\b\\w*qs=(?!u)\\w*\\b"
+ "|\\b\\w*encquery=(?!u)\\w*\\b|\\b\\w*k=(?!u)\\w*\\b\\b\\w*qt=(?!u)\\w*\\b"
+ "|\\b\\w*query=(?!u)\\w*\\b|\\b\\w*rdata=(?!u)\\w*\\b|\\b\\w*search_word=(?!u)\\w*\\b"
+ "|\\b\\w*szukaj|terms=(?!u)\\w*\\b\\b\\w*text=(?!u)\\w*\\b|\\b\\w*wd=(?!u)\\w*\\b|\\b\\w*words=(?!u)\\w*\\b";
foreach (Match m in Regex.Matches(strQuery, pattern)) {
string x = m.ToString();
x = x.Substring(1, x.Length - 1);
result += x;
}
return result.Replace("=", "");
}
Input: http:
Output:
codeproject.com