In a file is apparently stored a multiline regex, saved by YAML::dump(b1)
without a problem.
Question, how can I load it back when Syck seems to have issues with the multiline regular expression?
b2 = YAML::load(File.open("browserObj.yaml", 'r'))
Syck::TypeError: Invalid Regular expression: "/\\A\\s*\n ([a-zA-Z][\\-+.a-zA-Z\\d]*): (?# 1: scheme)\n (?:\n ((?:[\\-_.!~*'()a-zA-Z\\d;?:@&=+$,]|%[a-fA-F\\d]{2})(?:[\\-_.!~*'()a-zA-Z\\d;\\/?:@&=+$,\\[\\]]|%[a-fA-F\\d]{2})*) \\ (?# 2: opaque)\n |\n (?:(?:\n \\/\\/(?:\n \\ (?:(?:((?:[\\-_.!~*'()a-zA-Z\\d;:&=+$,]|%[a-fA-F\\d]{2})*)@)? \\ (?# 3: userinfo)\n (?:((?:(?:[a-zA-Z0-9\\-.]|%\\h\\h)+|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\[(?:(?:[a-fA-F\\d]{1,4}:)*(?:[a-fA-F\\d]{1,4}|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:(?:[a-fA-F\\d]{1,4}:)*[a-fA-F\\d]{1,4})?::(?:(?:[a-fA-F\\d]{1,4}:)*(?:[a-fA-F\\d]{1,4}|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}))?)\\]))(?::(\\d*))?))? (?# 4: host, 5: port)\n |\n ((?:[\\-_.!~*'()a-zA-Z\\d$,;:@&=+]|%[a-fA-F\\d]{2})+) \\ (?# 6: registry)\n )\n |\n (?!\\/\\/)) \\ (?# XXX: '\\/\\/' is the mark for hostport)\n \\ (\\/(?:[\\-_.!~*'()a-zA-Z\\d:@&=+$,]|%[a-fA-F\\d]{2})*(?:;(?:[\\-_.!~*'()a-zA-Z\\d:@&=+$,]|%[a-fA-F\\d]{2})*)*(?:\\/(?:[\\-_.!~*'()a-zA-Z\\d:@&=+$,]|%[a-fA-F\\d]{2})*(?:;(?:[\\-_.!~*'()a-zA-Z\\d:@&=+$,]|%[a-fA-F\\d]{2})*)*)*)? \\ (?# 7: path)\n )(?:\\?((?:[\\-_.!~*'()a-zA-Z\\d;\\/?:@&=+$,\\[\\]]|%[a-fA-F\\d]{2})*))? \\ (?# 8: query)\n )\n (?:\\#((?:[\\-_.!~*'()a-zA-Z\\d;\\/?:@&=+$,\\[\\]]|%[a-fA-F\\d]{2})*))? \\ (?# 9: fragment)\n \\s*\\z/x"
from /usr/lib/ruby/1.9.1/syck/rubytypes.rb:284:in `yaml_new'
from /usr/lib/ruby/1.9.1/syck.rb:135:in `transfer'
from /usr/lib/ruby/1.9.1/syck.rb:135:in `node_import'
from /usr/lib/ruby/1.9.1/syck.rb:135:in `load'
from /usr/lib/ruby/1.9.1/syck.rb:135:in `load'
from /usr/lib/ruby/1.9.1/syck.rb:146:in `block in load_file'
from /usr/lib/ruby/1.9.1/syck.rb:145:in `open'
from /usr/lib/ruby/1.9.1/syck.rb:145:in `load_file'
from (irb):428
from /usr/bin/irb:12:in `<main>'
I've seen discussion about a patch to rubytypes.rb but otherwise nothing.
I'd rather not switch to Psych since that opens up another can of worms:
YAML::ENGINE.yamler = "psych"
# attempt to load from file again
TypeError: can't convert Fixnum into String
What's going on? Is there any hope? I had no prior knowledge of Syck nor Psych nor the internals of YAML parsing until this error made it non-transparent.