in Projects, Programming, Technology

gsub is powerful One of these days I really have to get better at regular e…

gsub  is powerful

One of these days I really have to get better at regular expressions

    output = description
  
    unless output.nil?
      r = /src=\"?(http:\/\/[^\s\">]*)/
      output.gsub!(r){|s| "src=\"/images/?src=#{CGI::escape($1)}" }
    end
   
    output
 

Write a Comment

Comment