in reply to repeatedly delete words expressed in alternation from end of string [regexp]
while (s/\s*$RE$//) {} [download]
s/(\s*$RE)*$//; [download]