------art_24982_31314484.1153922836652
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 7/26/06, Tomas Fischer <tomas_fischer99 / yahoo.de> wrote:
>
> Hi,
>
> thanks for your solutions. But I've forgotten to mention, that r can
> contain brackets, so the simple way s.gsub(/#{r}$/,'') doesn't work.
>
> I use now the reverse, sub approach.
>
> Best regards,
> Tomas
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Well Thomas if your pattern is really at the end of the string you can use
the -- much faster --
anchoring approach Vincent suggested, just escape your regexp and use sub
instead of
gsub as pointed out by Edward in case there is only one line.

s.sub %r{#{Regexp.escape(r)}$}, ""

Robert

------art_24982_31314484.1153922836652--