Friday, November 02, 2007


Jeff Attwood blogged about his dislike of fluent interfaces. He happened to use Joshua Flanagan's fluent regex API as his example.

When Joshua first posted his example, last year, it inspired me write a more compact alternative. While the fluent style began in the Java community, the compact alternative uses the unique features of C# to deliver an easy-to-read result - without the verbosity of the fluent style.

Thanks to a little encouragement from Joshua, today I am posting the source code. I've called it "SmartRegex". Here's the source code, and here are the unit tests. The last of the tests is a full test of the exact example used by Joshua and Jeff.

Note that this version of SmartRegex contains just enough to implement Joshua's example. It does not support the rest of the regex syntax. If you are interested in a more complete example, email me or leave a comment below and I'll see what I can do.


Links to this post:

Create a Link

<< Home