I have a string like this :

```
string myText = "abc def ghi 123 abc def ghi 123 abc def";

```

I want to replace only last `abc` with empty.

Here is my code:

```
string pattern2 = "([abc])$";
string replacement2 = "";
Regex regEx = new Regex(pattern2);
var b = Regex.Replace(regEx.Replace(myText, replacement2), @"\s", " ");

```

It does not work properly, so how can it be done?