The "Programming Ruby" books says in the section "General Delimited
Input"

Following the type character is a delimiter, which can be any
character. If the delimiter is one of the characters
``('', ``['', ``{'', or ``<'', the literal consists of the
characters up to the matching closing delimiter

But i tried it with

print %Qahelloa
print %Q1hello1

and this does not work. Why? What characters are allowed ?