19 writes to Str
System.Text.RegularExpressions (19)
System\Text\RegularExpressions\RegexNode.cs (19)
68Str = str; 190Str = null; 198Str = new string(Ch, N); 1011Str = null; 1016Str = null; 1026Str = null; 1044Str = RegexCharClass.AnyClass; 1049Str = RegexCharClass.NotDigitClass; 1052Str = RegexCharClass.NotSpaceClass; 1055Str = RegexCharClass.NotWordClass; 1203prev.Str = prevCharClass.ToStringClass(); 1496node.Str = null; 1502node.Str = null; 1506node.Str = node.Str.Substring(startingSpan.Length); 1826prev.Str = prev.Ch.ToString(); 1829prev.Str = (optionsAt & RegexOptions.RightToLeft) == 0 ? 1972nextNode.Str = null; 1976nextNode.Str = nextNode.Str.Substring(matchingCharsInMulti); 3289Str = new string(Ch, max);
157 references to Str
System.Text.RegularExpressions (157)
System\Text\RegularExpressions\RegexCompiler.cs (24)
1364EmitMatchCharacterClass(target.LoopNode.Str!); 1473int length = node.Kind == RegexNodeKind.Multi ? node.Str!.Length : 1; 1952int numChars = RegexCharClass.GetSetChars(startingLiteralNode.Str!, setChars); 2096return multi.Str!.Length == 2 ? 2097new(RegexNodeKind.One, multi.Options, multi.Str[1]) : 2098new(RegexNodeKind.Multi, multi.Options, multi.Str.Substring(1)); 3253EmitMatchCharacterClass(node.Str); 3485EmitMultiCharString(node.Str!, emitLengthCheck, (node.Options & RegexOptions.RightToLeft) != 0); 3686Ldc(literal.Str![0]); 3691EmitMatchCharacterClass(literal.Str!); 4054node.Str == RegexCharClass.AnyClass && 4582if (node.IsSetFamily && node.Str == RegexCharClass.AnyClass) 4724EmitMatchCharacterClass(node.Str); 4759else if (node.IsSetFamily && maxIterations == int.MaxValue && node.Str == RegexCharClass.AnyClass) 4839EmitMatchCharacterClass(node.Str); 4961EmitMatchCharacterClass(node.Str); 5443literalLength = node.Str!.Length; 5456if (RegexCharClass.TryGetSingleRange(node.Str, out _, out _) || 5457RegexCharClass.GetSetChars(node.Str, setChars) > 0) 5478Ldstr(node.Str!); 5506bool negated = RegexCharClass.IsNegated(node.Str) ^ negate; 5510if (RegexCharClass.TryGetSingleRange(node.Str, out char lowInclusive, out char highInclusive) && 5527int setCharsCount = RegexCharClass.GetSetChars(node.Str, setChars); 5685Ldc((root.Kind == RegexNodeKind.Multi ? root.Str!.Length : 1) * (!rtl ? 1 : -1));
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
841while ((uint)--prev < (uint)slice.Length && RegexCharClass.CharInClass(slice[prev], loopNode.Str!, ref _asciiLookups![0])) ;
System\Text\RegularExpressions\RegexNode.cs (100)
95new RegexNode(Kind, Options, Str!) : 332Debug.Assert(node.Str is not null, "Expect non-null multi string"); 333Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 340Debug.Assert(!string.IsNullOrEmpty(node.Str), $"Expected non-null, non-empty string for {node.Kind}."); 344Debug.Assert(node.Str is null, $"Expected null string for {node.Kind}, got \"{node.Str}\"."); 1006Debug.Assert(!string.IsNullOrEmpty(Str)); 1008if (RegexCharClass.IsEmpty(Str)) 1013else if (RegexCharClass.IsSingleton(Str)) 1015Ch = RegexCharClass.SingletonChar(Str); 1023else if (RegexCharClass.IsSingletonInverse(Str)) 1025Ch = RegexCharClass.SingletonChar(Str); 1035switch (Str) 1160if (!wasLastSet || optionsLast != optionsAt || lastNodeCannotMerge || !RegexCharClass.IsMergeable(at.Str!)) 1163lastNodeCannotMerge = !RegexCharClass.IsMergeable(at.Str!); 1189prevCharClass = RegexCharClass.Parse(prev.Str!); 1198RegexCharClass atCharClass = RegexCharClass.Parse(at.Str!); 1279required.Str != other.Str) 1402scoped ReadOnlySpan<char> startingSpan = startingNode.Str.AsSpan(); 1438Debug.Assert(startingNode.Str!.Length > 0); 1440int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1442while (c < minLength && startingSpan[c] == startingNode.Str[c]) c++; 1492Debug.Assert(node.Str.AsSpan().StartsWith(startingSpan, StringComparison.Ordinal)); 1493if (node.Str!.Length == startingSpan.Length) 1498else if (node.Str.Length - 1 == startingSpan.Length) 1501node.Ch = node.Str[node.Str.Length - 1]; 1506node.Str = node.Str.Substring(startingSpan.Length); 1548return IsOneFamily ? Ch : Str![0]; 1599if (RegexCharClass.IsNegated(startingLiteralNode.Str!) || 1600(numChars = RegexCharClass.GetSetChars(startingLiteralNode.Str!, setChars)) == 0) 1673if (RegexCharClass.TryGetSingleRange(node.Str!, out char lowInclusive, out char highInclusive) && 1677return new StartingLiteralData(range: (lowInclusive, highInclusive), negated: RegexCharClass.IsNegated(node.Str!)); 1682if ((numChars = RegexCharClass.GetSetChars(node.Str!, setChars)) != 0) 1684return new StartingLiteralData(setChars: setChars.Slice(0, numChars).ToString(), negated: RegexCharClass.IsNegated(node.Str!)); 1689return new StartingLiteralData(@string: node.Str); 1830((at.Kind == RegexNodeKind.One) ? $"{prev.Str}{at.Ch}" : prev.Str + at.Str) : 1831((at.Kind == RegexNodeKind.One) ? $"{at.Ch}{prev.Str}" : at.Str + prev.Str); 1895case RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy when nextNode.Kind == currentNode.Kind && currentNode.Str == nextNode.Str: 1922case RegexNodeKind.Setloop or RegexNodeKind.Setlazy when nextNode.Kind == RegexNodeKind.Set && currentNode.Str == nextNode.Str: 1939currentNode.Ch == nextNode.Str![0]: 1944while (matchingCharsInMulti < nextNode.Str.Length && currentNode.Ch == nextNode.Str[matchingCharsInMulti]) 1959if (nextNode.Str.Length == matchingCharsInMulti) 1967Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1968if (nextNode.Str.Length - matchingCharsInMulti == 1) 1971nextNode.Ch = nextNode.Str[nextNode.Str.Length - 1]; 1976nextNode.Str = nextNode.Str.Substring(matchingCharsInMulti); 1990case RegexNodeKind.Set when (nextNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy) && currentNode.Str == nextNode.Str: 2004case RegexNodeKind.Set when nextNode.Kind == RegexNodeKind.Set && currentNode.Str == nextNode.Str: 2403case RegexNodeKind.Set when loopNode.Kind is RegexNodeKind.Setloop && RegexCharClass.IsSubsetOf(literal.Str!, loopNode.Str!): // e.g. \d+[0-9]\s 2411case RegexNodeKind.Multi when CharInLoopSet(loopNode, literal.Str![0]) && !CharInLoopSet(loopNode, literal.Str[1]): 2425RegexNodeKind.Setloop => RegexCharClass.CharInClass(ch, loopNode.Str!), 2525case RegexNodeKind.Set when !RegexCharClass.CharInClass(node.Ch, subsequent.Str!): 2528case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.Str!): 2529case RegexNodeKind.Multi when node.Ch != subsequent.Str![0]: 2540case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.Str!): 2555case RegexNodeKind.Multi when node.Ch == subsequent.Str![0]: 2572case RegexNodeKind.One when !RegexCharClass.CharInClass(subsequent.Ch, node.Str!): 2573case RegexNodeKind.Set when !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!): 2574case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!): 2575case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!): 2576case RegexNodeKind.Multi when !RegexCharClass.CharInClass(subsequent.Str![0], node.Str!): 2578case RegexNodeKind.EndZ or RegexNodeKind.Eol when !RegexCharClass.CharInClass('\n', node.Str!): 2579case RegexNodeKind.Boundary when node.M > 0 && RegexCharClass.IsSubsetOf(node.Str!, RegexCharClass.WordClass): 2580case RegexNodeKind.NonBoundary when node.M > 0 && node.Str is RegexCharClass.NotWordClass or RegexCharClass.NotDigitClass: 2581case RegexNodeKind.ECMABoundary when node.M > 0 && node.Str is RegexCharClass.ECMAWordClass or RegexCharClass.ECMADigitClass: 2582case RegexNodeKind.NonECMABoundary when node.M > 0 && node.Str is RegexCharClass.NotECMAWordClass or RegexCharClass.NotDigitClass: 2585case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!): 2586case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!): 2620case RegexNodeKind.Set when !MayOverlapStartingOrEndingSet(subsequent.Str!): 2622case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !MayOverlapStartingOrEndingSet(subsequent.Str!): 2623case RegexNodeKind.Multi when !CharInStartingOrEndingSet(subsequent.Str![0]): 2633case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !MayOverlapStartingOrEndingSet(subsequent.Str!): 2836return Str!.Length; 2949return Str!.Length; 3135if (!Ascii.IsValid(child.Str) || 3136RegexCharClass.ParticipatesInCaseConversion(child.Str.AsSpan())) 3141vsb.Append(child.Str); 3148if (!RegexCharClass.SetContainsAsciiOrdinalIgnoreCaseCharacter(child.Str!, twoChars)) 3434[MemberNotNullWhen(true, nameof(Str))] 3515foreach (char c in Str!) 3525sb.Append(' ').Append(RegexCharClass.DescribeSet(Str!));
System\Text\RegularExpressions\RegexNodeKind.cs (5)
22/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>.</remarks> 26/// <remarks>The characters are specified in <see cref="RegexNode.Str"/>. This is purely a representational optimization, equivalent to multiple <see cref="One"/> nodes concatenated together.</remarks> 40/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 53/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 71/// The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (20)
129sb.Append(node.Str); 136foreach (char c in node.Str!) 156case RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic when !RegexCharClass.IsNegated(node.Str!): // negated sets are too complex to analyze 158int charCount = RegexCharClass.GetSetChars(node.Str!, setChars); 197if (!RegexCharClass.SetContainsAsciiOrdinalIgnoreCaseCharacter(node.Str!, setChars)) 428vsb.Append(node.Str); 623string s = node.Str!; 636results.Add(new RegexFindOptimizations.FixedDistanceSet(null, node.Str!, distance++)); 647results.Add(new RegexFindOptimizations.FixedDistanceSet(null, node.Str!, distance++)); 986cc = RegexCharClass.Parse(node.Str!); 989else if (cc.CanMerge && RegexCharClass.Parse(node.Str!) is { CanMerge: true } setCc) 1005cc.AddChar(node.Str![firstChar ? 0 : node.Str.Length - 1]); 1184RegexCharClass.CharInClass(prefix[0], firstChild.Str!) ? null : 1205if (RegexCharClass.CharInClass((char)(ordinalCaseInsensitivePrefix[0] | 0x20), firstChild.Str!) || 1206RegexCharClass.CharInClass((char)(ordinalCaseInsensitivePrefix[0] & ~0x20), firstChild.Str!)) 1211else if (RegexCharClass.CharInClass(ordinalCaseInsensitivePrefix[0], firstChild.Str!)) 1232!RegexCharClass.IsNegated(nextChild.Str!) && 1236chars = chars.Slice(0, RegexCharClass.GetSetChars(nextChild.Str!, chars)); 1241if (RegexCharClass.CharInClass(c, firstChild.Str!))
System\Text\RegularExpressions\RegexReplacement.cs (1)
51vsb.Append(child.Str!);
System\Text\RegularExpressions\RegexWriter.cs (3)
407int stringCode = StringCode(node.Str!); 420Emit((RegexOpcode)node.Kind | bits, StringCode(node.Str!)); 424Emit((RegexOpcode)node.Kind | bits, StringCode(node.Str!));
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (3)
72string? str = node.Str; 125string? set = node.Str; 314string? set = node.Str;