Question: How can I remove the **whole word** `on` (**not the substring** `on` in the `Confirmed`) from the following string?

```
X-JP409 Confirmed on 13/2/12

```

Answer: 
```
"X-JP409 Confirmed on 13/2/12".replace(" on ", " ");

```

[String replace documentation](http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#replace)
What about:

```
String str = "X-JP409 Confirmed on 13/2/12";
str.replaceAll(" on ", " ");

```

The output is what you are looking for:

```
X-JP409 Confirmed 13/2/12

```