in reply to REGEX with input file

My guess is that your problem is not with the regex, but with the rest of your program, esp. the parts that write to your "outputfile".

Perhaps you can show us some of that code.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law