From: Robert Klemme Date: 2012-09-14T17:08:09+09:00 Subject: Re: want to get string between specialchars at endof the string On Fri, Sep 14, 2012 at 10:00 AM, Joel Pearson wrote: > The quick way to do that would be: > > "tesubyrails ".split(" <").each do |el| puts > el[0..-2] end > > If you wanted something a bit more flexible I recommend regex. Like irb(main):001:0> s = 'tesubyrails ' irb(main):002:0> if %r{\A(.*?)\s+(<.*?>)\z} =~ s then front=$1; rear=$2; p front, rear; end "tesubyrails" "" => ["tesubyrails", ""] > Do you have more examples, or is this static data you're using? That would certainly be helpful. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/