7stud -- wrote:
> str = " cost * tax = 123"
> words = []
> 
> str.split().map do |word|
>   good_word = true
> 
>   word.each_byte do |code|
>     if code < ?a or code > ?z
>       good_word = false
>       break
>     end
>   end
> 
>   if good_word
>     words << word
>   end
> end
> 
> p words
> 
> --output:--
> ["cost", "tax"]

That's clever use of ?a, which I recognize but have never seen anyone 
use before. Thanks for the example!

Jim Clark wrote:
> "Mastering Regular Expressions" by Jeffrey Friedl. I haven't seen the
> third edition to see if there is any Ruby specific examples but even
> with all the Perl examples in the first edition, I still use it as a
> reference because of the similarities between Perl and Ruby's regular
> expressions.

I shall check that out Jim, thanks much.
-- 
Posted via http://www.ruby-forum.com/.