I want to insert the following as the value for a variable in some Ruby:
`~!@#$%^&*()_-+={}|[]\\:\";\'<>?,./
Surrounding this in doub
First, unless I'm crazy %q()
does work here, perfectly well, since the inner parentheses are balanced:
>> weird = %q(`~!@#$%^&*()_-+={}|[]\:";'<>?,./)
=> "`~!@\#$%^&*()_-+={}|[]\\:";'<>?,./"
>> puts weird
`~!@#$%^&*()_-+={}|[]\:";'<>?,./
As a side note: when using %q
, you always have the nuclear option of using spaces as the delimiter. This is foul and officially a Bad Idea, but it works.
Again, I wouldn't do it, but just to see...
>> weird = %q `~!@#$%^&*()_-+={}|[]\:";'<>?,./
=> "`~!@\#$%^&*()_-+={}|[]\\:";'<>?,./"