I want to remove empty quote lines at the end of a mail:

```
> Hello
> 
> thats quotet>
>
>

```

to 

```
> Hello
> 
> thats quotet>

```

But the regex `preg_replace("/^>\W*$/m", "", $input_lines)` won't do the trick because it also removes the > of the empty line thats not at the end.

edit: And there is still the problem, that only > at the beginning of a line should be removed