From the end of a string I need to remove specific strings. I could do this with a loop, but I think it should be possible with a regex.
Example: remove all <br>, and whitespace from the end of my input string.
"Hello world<br> <br> "
should become
"Hello world".
I have tried various permutations of
$input = preg_replace('/(<br>| | )*$/', '', $input);
but in the end my regex knowledge fails me. How can I do this?