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.