>> I wanna do something like newstr = str.strip(/\D/)
>>
>> I know I could do newstr = str.sub(/^\D*/,'').sub(/\D*$/,''), but is
>> there
>> any
>> better way?
>
> Use #slice / #[]:
>
> irb(main):006:0> s = "aaa111bbb222ccc"
> => "aaa111bbb222ccc"
> irb(main):007:0> s[/\A\D*(.*)\D*\z/, 1]
> => "111bbb222ccc"

Oops, gotta be non-greedy:

irb(main):001:0> s = "aaa111bbb222ccc"
=> "aaa111bbb222ccc"
irb(main):002:0> s[/\A\D*(.*?)\D*\z/, 1]
=> "111bbb222"