Displaying 1 result from an estimated 1 matches for "full_text_array".
2010 Mar 03
0
Using gsub to replace text with link from database
...at:
#This code is taking the sentence and scanning it for two words that
are next to each other that have the first letter capitalized
@new_link_array = #this is the link data that is returned from my query
search via ferret. It will provide the proper link to the players.
@full_text = params[:q]
@full_text_array = @full_text.scan(/([A-Z]+[a-zA-Z]* [A-Z]+[a-zA-Z]*)/)
@full_text_array.each_with_index do |original_name, i|
@full_text.gsub!(original_name.to_s, @new_link_array[i])
end
results = @full_text.scan(/([A-Z]+[a-zA-Z]* [A-Z]+[a-zA-Z]*)/)
names_links = {}
results.each do |name|
unless names_...