-2

how I can apply stream reader over regex loop

please help i dont know

     string Value =pattern search;
        var match = Regex.Match(File.ReadAllText(patch ) , Value);  
    while (match.Success)
{

  doing regex code loop 
  }

please give me a hand

1 Answers1

1

You can use Regex.Matches.

var matches = Regex.Matches(File.ReadAllText(patch), Value);
foreach (var match in matches)
{
    //do what you want with every match
}
Hamid Pourjam
  • 20,441
  • 9
  • 58
  • 74
  • thanks but this is a stream reader ? –  Aug 13 '16 at 04:45
  • 1
    What do you mean by stream reader? – Hamid Pourjam Aug 13 '16 at 04:45
  • 1
    i see this http://stackoverflow.com/questions/12812538/regex-extremely-slow-on-large-documents , but i dont know how apply stream reader in a loop –  Aug 13 '16 at 04:48
  • 1
    http://stackoverflow.com/questions/13810693/is-there-a-fast-way-to-parse-through-a-large-file-with-regex –  Aug 13 '16 at 04:48