From: "Peña, Botp" Date: 2003-06-25T15:38:59+09:00 Subject: Re: another problem with regular expression Rob [mailto:robson@magario.com] wrote: > I have an array with the following elements: > > array[0] = "car" > array[1] = "bike" > array[2] = "motorcicle" > ....... > array[n] = ......... > > And I have a string with the following text. > > "Today I went to school by car. I saw............ " > > What I am trying to do is that everytime the program finds > one of the words from the list in the text, it will place an > astherisc * to replace that word. how about: C:\family\ruby>type a1.rb array = [] array[0] = "car" array[1] = "bike" array[2] = "motorcicle" #p array str = "Today I went to school by car. I saw a bike............ " array.each {|word| str.gsub!(word,"*") } p str C:\family\ruby>ruby a1.rb "Today I went to school by *. I saw a *............ " > But I cannot figure out how to do this because it is an array > not a regular expression. > > Rob > kind regards -botp