i want do do multiple regular expression replacements on a array, i have this working code but it seems not the ruby-way, anyone who has a better solution ?
#files contains the string that need cleaning
files = [
"Beatles - The Word ",
"The Beatles - The Word",
"Beatles - Tell Me Why",
"Beatles - Tell Me Why (remastered)",
"Beatles - Love me do"
]
#ignore contains the reg expr that need to bee checked
ignore = [/the/,/\(.*\)/,/remastered/,/live/,/remix/,/mix/,/acoustic/,/version/,/ +/]
files.each do |file|
ignore.each do |e|
file.downcase!
file.gsub!(e," ")
file.strip!
end
end
p files
#=>["beatles - word", "beatles - word", "beatles - tell me why", "beatles - tell me why", "beatles - love me do"]