pattern = %r{(["'])(\\\1|[^\1]*?)\1} string = %Q(var msg = 'hello' + 'world') print string.gsub(pattern, '<span>\1\2\1</span>')
Standard input is empty
var msg = <span>'hello'</span> + <span>'world'</span>
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!