« Home | Triplet » | csharpformat test » | ADO.NET Black Helicopters » | VSS 2005 Add Files » | ADO.NET Video Followup » | What's coming in ADO.NET Video » | Pinvoke Convenience » | WPF/E and IL Code » | A real choice? » | Xbox 360 CLR Possibility »

Regex Fail All

I’m currently writing a small utility which takes a snapshot of the state of a Windows system and reports back to base as to the system state. This is being done to assist in resolving an application problem where the program doesn’t respond for a minute or so and then goes back to being responsive. The application logs provide no indication of any problems and its difficult to get end users to perform any in depth analysis. Its also a short enough period of unresponsiveness that it usually goes away before any remote assistance sessions could be set up. The application is being called Torq Snapshot and will have some level of configurability to that certain portions of the Windows system can be interrogated in depth as needed.

To facilitate this a number of filters are being defined using .NET Regex functionality so that specific processes are to be included in the snapshot. The configuration options are intended to be used by software developers so they don’t have to be easy to use. A need arose where it was convenient to be able to set the filter to a Regex pattern that failed all matches. Regex is one of those software areas that I use rarely enough that it always takes me a short while to get up to speed again when its needed on an adhoc basis. The end result was that a regex of the form [^\d\D] or [^\w\W] can be used to always fail i.e. “notting” the “or” of two mutually exclusive sets. I was hoping that a straight [] would do it but that failed with a run time exception.

Links to this post

Create a Link