   [.net] RegEx: Removing brackets from a string
  I have written a method to remove brackets (both "()" and "[]") using regex. It looks like thispublic static string RemoveBrackets(string str){str = Regex.Replace(str, @"\[.+?\]", "");str = Regex.Replace(str, @"\(.+?\)", "");str = str.Replace("  ", " ");return str.Trim();}I found found a situation where this method does not work how I want. For example if I have the following string:"2 Pak Special (Black) - Challenge, Surfing (1990) (HES) (PAL) [!]"I am only supposed to remove the bracketed text at the end, not inside the game name.So it should be returning"2 Pak Special (Black) - Challenge, Surfing"But instead it it's returning"2 Pak Special - Challenge, Surfing"How can I change the regex to only remove brackets at the end of the string?   
  You can simplify that function into one RegEx Replace call easily enough. Matching the end of the string is just a matter of using the $ symbol.This should work for you (and removes the spaces too).public static string RemoveBrackets(string str){    return Regex.Replace(str, @"(?: ?[(\[][^)\]]+.)*$", "");};  Sweet thanks alex_myrpg works great!   