I\'ve got an exception log from one of production code releases.
System.OutOfMemoryException: Exception of type \'System.OutOfMemoryException\' was thrown.
The first thing I would try, if it is possible for your application, would be to split up the input.
Would it be possible to read the file (if the input is a file) line-by-line, applying the Regular Expression that way?
You should take a look with CLR Profiler. It can take a little time to learn how to use, but it's worth it. It will help you visualize how much memory your objects use.