16 writes to Str
System.Text.RegularExpressions (16)
System\Text\RegularExpressions\RegexNode.cs (16)
68
Str
= str;
178
Str
= null;
186
Str
= new string(Ch, N);
882
Str
= null;
887
Str
= null;
897
Str
= null;
915
Str
= RegexCharClass.AnyClass;
1047
prev.
Str
= prevCharClass.ToStringClass();
1335
node.
Str
= null;
1341
node.
Str
= null;
1345
node.
Str
= node.Str.Substring(startingSpan.Length);
1595
prev.
Str
= prev.Ch.ToString();
1598
prev.
Str
= (optionsAt & RegexOptions.RightToLeft) == 0 ?
1741
nextNode.
Str
= null;
1745
nextNode.
Str
= nextNode.Str.Substring(matchingCharsInMulti);
2695
Str
= new string(Ch, max);
123 references to Str
System.Text.RegularExpressions (123)
System\Text\RegularExpressions\RegexCompiler.cs (1)
1339
EmitMatchCharacterClass(target.LoopNode.
Str
!);
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
811
while ((uint)--prev < (uint)slice.Length && RegexCharClass.CharInClass(slice[prev], loopNode.
Str
!, ref _asciiLookups![0])) ;
System\Text\RegularExpressions\RegexNode.cs (89)
95
new RegexNode(Kind, Options,
Str
!) :
292
Debug.Assert(node.
Str
is not null, "Expect non-null multi string");
293
Debug.Assert(node.
Str
.Length >= 2, $"Expected {node.
Str
} to be at least two characters");
300
Debug.Assert(!string.IsNullOrEmpty(node.
Str
), $"Expected non-null, non-empty string for {node.Kind}.");
304
Debug.Assert(node.
Str
is null, $"Expected null string for {node.Kind}, got \"{node.
Str
}\".");
877
Debug.Assert(!string.IsNullOrEmpty(
Str
));
879
if (RegexCharClass.IsEmpty(
Str
))
884
else if (RegexCharClass.IsSingleton(
Str
))
886
Ch = RegexCharClass.SingletonChar(
Str
);
894
else if (RegexCharClass.IsSingletonInverse(
Str
))
896
Ch = RegexCharClass.SingletonChar(
Str
);
906
switch (
Str
)
1004
if (!wasLastSet || optionsLast != optionsAt || lastNodeCannotMerge || !RegexCharClass.IsMergeable(at.
Str
!))
1007
lastNodeCannotMerge = !RegexCharClass.IsMergeable(at.
Str
!);
1033
prevCharClass = RegexCharClass.Parse(prev.
Str
!);
1042
RegexCharClass atCharClass = RegexCharClass.Parse(at.
Str
!);
1126
required.
Str
!= other.
Str
)
1241
scoped ReadOnlySpan<char> startingSpan = startingNode.
Str
.AsSpan();
1277
Debug.Assert(startingNode.
Str
!.Length > 0);
1279
int minLength = Math.Min(startingSpan.Length, startingNode.
Str
.Length);
1281
while (c < minLength && startingSpan[c] == startingNode.
Str
[c]) c++;
1331
Debug.Assert(node.
Str
.AsSpan().StartsWith(startingSpan, StringComparison.Ordinal));
1332
if (node.
Str
!.Length == startingSpan.Length)
1337
else if (node.
Str
.Length - 1 == startingSpan.Length)
1340
node.Ch = node.
Str
[node.
Str
.Length - 1];
1345
node.Str = node.
Str
.Substring(startingSpan.Length);
1387
return IsOneFamily ? Ch :
Str
![0];
1442
if (RegexCharClass.TryGetSingleRange(node.
Str
!, out char lowInclusive, out char highInclusive) &&
1446
return new StartingLiteralData(range: (lowInclusive, highInclusive), negated: RegexCharClass.IsNegated(node.
Str
!));
1451
if ((numChars = RegexCharClass.GetSetChars(node.
Str
!, setChars)) != 0)
1453
return new StartingLiteralData(setChars: setChars.Slice(0, numChars).ToString(), negated: RegexCharClass.IsNegated(node.
Str
!));
1458
return new StartingLiteralData(@string: node.
Str
);
1599
((at.Kind == RegexNodeKind.One) ? $"{prev.
Str
}{at.Ch}" : prev.
Str
+ at.
Str
) :
1600
((at.Kind == RegexNodeKind.One) ? $"{at.Ch}{prev.
Str
}" : at.
Str
+ prev.
Str
);
1664
case RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy when nextNode.Kind == currentNode.Kind && currentNode.
Str
== nextNode.
Str
:
1691
case RegexNodeKind.Setloop or RegexNodeKind.Setlazy when nextNode.Kind == RegexNodeKind.Set && currentNode.
Str
== nextNode.
Str
:
1708
currentNode.Ch == nextNode.
Str
![0]:
1713
while (matchingCharsInMulti < nextNode.
Str
.Length && currentNode.Ch == nextNode.
Str
[matchingCharsInMulti])
1728
if (nextNode.
Str
.Length == matchingCharsInMulti)
1736
Debug.Assert(matchingCharsInMulti < nextNode.
Str
.Length);
1737
if (nextNode.
Str
.Length - matchingCharsInMulti == 1)
1740
nextNode.Ch = nextNode.
Str
[nextNode.
Str
.Length - 1];
1745
nextNode.Str = nextNode.
Str
.Substring(matchingCharsInMulti);
1759
case RegexNodeKind.Set when (nextNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy) && currentNode.
Str
== nextNode.
Str
:
1773
case RegexNodeKind.Set when nextNode.Kind == RegexNodeKind.Set && currentNode.
Str
== nextNode.
Str
:
2122
case RegexNodeKind.Set when !RegexCharClass.CharInClass(node.Ch, subsequent.
Str
!):
2125
case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.
Str
!):
2126
case RegexNodeKind.Multi when node.Ch != subsequent.
Str
![0]:
2133
case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.
Str
!):
2152
case RegexNodeKind.Multi when node.Ch == subsequent.
Str
![0]:
2169
case RegexNodeKind.One when !RegexCharClass.CharInClass(subsequent.Ch, node.
Str
!):
2170
case RegexNodeKind.Set when !RegexCharClass.MayOverlap(node.
Str
!, subsequent.
Str
!):
2171
case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.
Str
!):
2172
case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.MayOverlap(node.
Str
!, subsequent.
Str
!):
2173
case RegexNodeKind.Multi when !RegexCharClass.CharInClass(subsequent.
Str
![0], node.
Str
!):
2175
case RegexNodeKind.EndZ or RegexNodeKind.Eol when !RegexCharClass.CharInClass('\n', node.
Str
!):
2178
case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.
Str
!):
2179
case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.MayOverlap(node.
Str
!, subsequent.
Str
!):
2180
case RegexNodeKind.Boundary when node.M > 0 && node.
Str
is RegexCharClass.WordClass or RegexCharClass.DigitClass:
2181
case RegexNodeKind.NonBoundary when node.M > 0 && node.
Str
is RegexCharClass.NotWordClass or RegexCharClass.NotDigitClass:
2182
case RegexNodeKind.ECMABoundary when node.M > 0 && node.
Str
is RegexCharClass.ECMAWordClass or RegexCharClass.ECMADigitClass:
2183
case RegexNodeKind.NonECMABoundary when node.M > 0 && node.
Str
is RegexCharClass.NotECMAWordClass or RegexCharClass.NotDigitClass:
2270
return
Str
!.Length;
2383
return
Str
!.Length;
2546
if (!RegexCharClass.IsAscii(child.
Str
.AsSpan()) ||
2547
RegexCharClass.ParticipatesInCaseConversion(child.
Str
.AsSpan()))
2552
vsb.Append(child.
Str
);
2559
if (!RegexCharClass.SetContainsAsciiOrdinalIgnoreCaseCharacter(child.
Str
!, twoChars))
2832
[MemberNotNullWhen(true, nameof(
Str
))]
2913
foreach (char c in
Str
!)
2923
sb.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)
129
sb.Append(node.
Str
);
136
foreach (char c in node.
Str
!)
156
case RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic when !RegexCharClass.IsNegated(node.
Str
!): // negated sets are too complex to analyze
158
int charCount = RegexCharClass.GetSetChars(node.
Str
!, setChars);
197
if (!RegexCharClass.SetContainsAsciiOrdinalIgnoreCaseCharacter(node.
Str
!, setChars))
428
vsb.Append(node.
Str
);
623
string s = node.
Str
!;
636
results.Add(new RegexFindOptimizations.FixedDistanceSet(null, node.
Str
!, distance++));
647
results.Add(new RegexFindOptimizations.FixedDistanceSet(null, node.
Str
!, distance++));
977
cc = RegexCharClass.Parse(node.
Str
!);
980
else if (cc.CanMerge && RegexCharClass.Parse(node.
Str
!) is { CanMerge: true } setCc)
995
cc.AddChar(node.
Str
![(node.Options & RegexOptions.RightToLeft) != 0 ? node.
Str
.Length - 1 : 0]);
1160
RegexCharClass.CharInClass(prefix[0], firstChild.
Str
!) ? null :
1181
if (RegexCharClass.CharInClass((char)(ordinalCaseInsensitivePrefix[0] | 0x20), firstChild.
Str
!) ||
1182
RegexCharClass.CharInClass((char)(ordinalCaseInsensitivePrefix[0] & ~0x20), firstChild.
Str
!))
1187
else if (RegexCharClass.CharInClass(ordinalCaseInsensitivePrefix[0], firstChild.
Str
!))
1208
!RegexCharClass.IsNegated(nextChild.
Str
!) &&
1212
chars = chars.Slice(0, RegexCharClass.GetSetChars(nextChild.
Str
!, chars));
1217
if (RegexCharClass.CharInClass(c, firstChild.
Str
!))
System\Text\RegularExpressions\RegexReplacement.cs (1)
51
vsb.Append(child.
Str
!);
System\Text\RegularExpressions\RegexWriter.cs (3)
407
int stringCode = StringCode(node.
Str
!);
420
Emit((RegexOpcode)node.Kind | bits, StringCode(node.
Str
!));
424
Emit((RegexOpcode)node.Kind | bits, StringCode(node.
Str
!));
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (3)
72
string? str = node.
Str
;
125
string? set = node.
Str
;
314
string? set = node.
Str
;