I have this string: "@OKFN @417_tw The _European Commission; && _European Governments; are consulting on Open Research Data; read our response: http://blog.okfn.org/2013/07/16/ec-consultation-on-open-research-data" and i want to replace all couples of words preceded by "_" and ended with ";" by the same words but without those characters.
Here's how i did it, but i dont think its very neat. Would there be a better way to do it?
subj="@OKFN @417_tw The _European Commission; && _European Governments; are consulting on Open Research Data; read our response: http://blog.okfn.org/2013/07/16/ec-consultation-on-open-research-data"
tags=subj.scan(/_[a-zA-Z0-9]+\s*[a-zA-Z0-9]+;/)
tags.each do |t|
t.gsub!(/_|;/,"")
subj.sub!("_"+t+";",t)
end
puts subj