Use regular expression string: and$
string query = Regex.Replace(".net and asp.net and", @"and$", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline);
Output will be:
".net and asp.net "
Or replace regular expression string to \w+$, this will find the last word in a string.
If u want to remove only last "and" then you could use this
<pre lang="cs">string s = @".net and asp.net and" ;
string output = s.TrimEnd("and");