Hi all,

I'm having some trouble finding an elegant way of removing a part of a
string based on an pattern.

Suppose I want to chop off the "Begin" in the string "BeginCaption".
My solution is this:

thePane = widgetdescription.scan( /Begin\w+/ )[0]
thePane = widgetdescription.["Begin".length..thePane.length]

Personally I don't find this method very elegant.

Can anybody offer me some hints on how to make this code more
presentable?

Also perhaps a similar strategy if I would want to remove something
from the middle or the end?

Best regards,
Francis