From 808cc706217b750f83aa7e2697213afeee20df1b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 23 Mar 2020 17:17:24 +0100 Subject: [PATCH] Compose hex sequences start with \0x, not \x. Reported in #329. --- src/sequences/SequenceTree.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sequences/SequenceTree.cs b/src/sequences/SequenceTree.cs index b9f50d39..e1344a16 100644 --- a/src/sequences/SequenceTree.cs +++ b/src/sequences/SequenceTree.cs @@ -140,15 +140,15 @@ private void ParseRule(string line) { result = result.Trim('"'); // Unescape \n \\ \" and more in the string output - result = Regex.Replace(result, @"\\([0-7]{3}|x[0-7a-fA-F]{4}|.)", m => + result = Regex.Replace(result, @"\\([0-7]{3}|0x[0-7a-fA-F]{4}|.)", m => { var s = m.Value; if (s.Length == 4) // Octal escape return ((char)Convert.ToInt32(s.Substring(1), 8)).ToString(); - if (s.Length == 6) // Hex escape - return ((char)Convert.ToInt32(s.Substring(2), 16)).ToString(); + if (s.Length == 7) // Hex escape + return ((char)Convert.ToInt32(s.Substring(3), 16)).ToString(); switch (s[1]) {