From f59ce53f265dd2b2ada018a911d917a3eaeace99 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 Jan 2015 14:59:18 +0000 Subject: yaml_tree.rb: fix anchor * ext/psych/lib/psych/visitors/yaml_tree.rb (visit_String): anchors like `\Z` are not valid inside character class. use negative-lookahead instead. Fixes: https://github.com/tenderlove/psych/issues/221 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/visitors/yaml_tree.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/psych') diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index c1039c6db0..8841cb0fc9 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -310,7 +310,7 @@ module Psych style = Nodes::Scalar::LITERAL plain = false quote = false - elsif o =~ /\n[^\Z]/ # match \n except blank line at the end of string + elsif o =~ /\n(?!\Z)/ # match \n except blank line at the end of string style = Nodes::Scalar::LITERAL elsif o == '<<' style = Nodes::Scalar::SINGLE_QUOTED -- cgit v1.2.3