Yohanes Santoso wrote: > > Chris <chris / cmb-enterprises.com> writes: > > > In article <3CAB5620.F1D693C1 / path.berkeley.edu>, > > Joel VanderWerf <vjoel / PATH.Berkeley.EDU> wrote: > > > > > Chris wrote: > > > > > > > Ah, but the real magic of """ is something like: > > > > > > > > >>> foo = """here's a single quote mark""" > > > > >>> foo > > > > "<a href=\"bar.html\">here's a single quote mark</a>" > > > > > > What about > > > > > > irb(main):001:0> foo = %{<a href="bar.html">here's a single quote > > > mark</a>} > > > "<a href=\"bar.html\">here's a single quote mark</a>" > > > > You'd still have to escape out any } that might actually occur in the > > string. Only if the { } are not balanced. > foo = %q# quotation marker can be any non-alphanumeric char # > foo2 = %Q@ foo=#{foo} @ I always forget about this. What's really cool is that you can use newlines: irb(main):013:0> foo = % irb(main):014:0" grabs the whole line irb(main):015:0> "grabs the whole line" and for single quoting you can use %q instead of %, and you can use %x for shell escape: ls = %x ls puts ls # ==> string with ls output