Daniel Waite wrote:
> What I'd like is to grab all the "words" in the string. 
> So how does that work if I wanted to match ALL occurrences
> of \w+ WITHOUT scan?

Your using the wrong method. match() only returns the first match:

pattern = /x.x/
str = "xax hello xbx"

puts pattern1.match(str)

--output:--
xax

>
> So how does that work if I wanted to match ALL occurrences
> of \w+ WITHOUT scan?
>

str = " cost * tax"
words = str.split("*").map {|elmt| elmt.strip()}
p words

--output:--
["cost", "tax"]



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"]

-- 
Posted via http://www.ruby-forum.com/.