http://qs321.pair.com?node_id=649291


in reply to repeatedly delete words expressed in alternation from end of string [regexp]

I'm a bit surprised that I didn't notice anybody offering the simple, obvious solution:

s/(\s+$RE)+$//;

(tested) Update: One was hidden in the middle of gamache's sentence.

- tye        

  • Comment on Re: regexp - repeatedly delete words expressed in alternation from end of string (KISS)
  • Download Code