fork download
  1. pattern = %r{(href='[^']+')}
  2. str = "This website is <a href='www.google.com'>Google</a>, some other website is <a href='www.facebook.com'>Facebook</a>"
  3. style_to_add = "style='text-decoration:none;'"
  4. print str.gsub(pattern, '\1 ' + style_to_add)
Success #stdin #stdout 0.05s 9656KB
stdin
Standard input is empty
stdout
This website is <a href='www.google.com' style='text-decoration:none;'>Google</a>, some other website is <a href='www.facebook.com' style='text-decoration:none;'>Facebook</a>