I have the below code snippet:
我有以下代码片段:
line_sub = Regexp.new(/\s+|"|\[|\]/)
tmp = Array.new
# reading a file
while line = file.gets
...
tmp[0],tmp[1] = line.to_s.scan(/^.*$/).to_s.split('=')
#remove unwanted characters
tmp.collect! do |val|
val.gsub(line_sub, "")
end
...
end