So, I'm working on a data import program that deals with a couple dozen files, all fixed width. Of course, even though they are all fixed-width, some are quoted, some are not. Some have a couple fields, some have many. I think the biggest file I'm dealing with is around 1gb (yes...gigabyte). This file has 77 fields that make up the full 922 byte record.
Anyway...so, I've always used ActiveState Komodo to help with my regex development and debugging. It's a great tool, but the version I have is a couple years old and I don't feel like spending the $$$ to upgrade. After checking some blogs, I found a couple of regex “IDEs”.
The first is 'The Regulator' by Roy Osherove. I'm using the latest-and-greatest version: 2.0.3.0. This is a great program, but the only drawback I've found is that when I generate code based on my regex, sometimes the “escaped” regex won't work once it's in my code. Roy doesn't use the '@' literal character, instead escaping all of the special characters. This means you're regex ends up looking like this:
string regex = “\\\“(\\w.*)\\“,\\“(\\w.*)\\““;
The second program I tried is Eric Gunnerson's 'RegEx Workbench'. This program, while not as pretty as The Regulator, is pretty cool. This does a better job when generating code.
string regex = @”\””(\w.*)\””,\””(\w.*)\”””;
Like Eric said: “It's easy to try out a regex in Perl, but not so easy in a compiled language like C#. “ I agree 100%.