Hello,
i am wandering if it is possible to split a character class ([...]) in
Ruby regex over multiple lines.

I know that the /x option allows to ignore whitespace, so i can write :

    email_format = /\A(
                      [A-Za-z\d\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+
                      \.)*
                      [A-Za-z\d\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+
                      @([a-z\d\-]+\.)+[a-z\d\-]+\z/x

However, if i try to split inside a character class:

    name_format = /\A[A-Za-z\d
                      \!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]\z/x

i get the warning:

    warning: character class has duplicated range

(apparently it is about the space character being included multiple
times inside []).
I want the space and newlines to be disregarded inside [] to format it
over multiple lines, is this possible?

Thanks,

Alexey.

-- 
Posted via http://www.ruby-forum.com/.