diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs index 7287e39125f1e1..edd7dfff101527 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs @@ -1929,7 +1929,7 @@ internal static int MapCaptureNumber(int capnum, Hashtable? caps) => private static ReadOnlySpan Category => [ // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 0, 0, 0, 0, 0, 0, 0, 0, W, W, 0, W, W, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, W, W, W, W, W, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? W, 0, 0, Z, S, 0, 0, 0, S, S, Q, Q, 0, 0, S, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Q, // @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ @@ -1939,7 +1939,7 @@ internal static int MapCaptureNumber(int capnum, Hashtable? caps) => ]; private static readonly SearchValues s_metachars = - SearchValues.Create("\t\n\f\r #$()*+.?[\\^{|"); + SearchValues.Create("\t\n\v\f\r #$()*+.?[\\^{|"); /// Returns true for those characters that terminate a string of ordinary chars. private static bool IsSpecial(char ch) => ch <= '|' && Category[ch] >= S; diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs index 01553e0659b850..13a7d4daaea6dc 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs @@ -581,6 +581,12 @@ public static IEnumerable Match_MemberData() // "x" option. Removes unescaped whitespace from the pattern. : Actual - "\x20([^/]+)\x20","x" yield return ("\x20([^/]+)\x20\x20\x20\x20\x20\x20\x20", " abc ", RegexOptions.IgnorePatternWhitespace, 0, 10, true, " abc "); + // "x" option. Vertical tab should be ignored as whitespace + if (!PlatformDetection.IsNetFramework) + { + yield return ("a\vb", "ab", RegexOptions.IgnorePatternWhitespace, 0, 2, true, "ab"); + } + // Turning on case insensitive option in mid-pattern : Actual - "aaa(?i:match this)bbb" if ("i".ToUpper() == "I") {