-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-System.Text.RegularExpressionsuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Using RegexOptions.Multiline should be the same as reading a file line by line I think.
When reading an entire file, and the Regexing it with RegexOptions.Multiline should be same as reading it line by line
Here is a code sample:
`
string path = @"PathToFile";
using (StreamReader reader = new StreamReader(path))
{
//string s = reader.ReadToEnd();
//int matchCount = Regex.Matches(s, @"^(.+)/([^/]+)$", RegexOptions.Compiled | RegexOptions.Multiline).Count; //I think this should be the same as below:
int matchCount = 0;
string s;
while ((s = reader.ReadLine()) != null)
{
matchCount += Regex.Matches(s, @"^(.+)\/([^/]+)$", RegexOptions.Compiled).Count;
}
Console.WriteLine(matchCount);
}
`
This is probably related to #25598
This may be I'm just completely doing it wrong, and I apologize if this is very stupid.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Text.RegularExpressionsuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner