I don't know Regex

Do you?

I have used Regex for trivial tasks, validating some input data (never validate emails with Regex btw, that is a Bad Thing TM), some really simple parsing etc. But I do not know how to write it.

I Google. And I find some type of designer and then I pretty much bruteforce my way until i find the right combination of dots, questionmarks and brackets.

I spent the day trying to learn a bit more about Regex. I did learn some, but instead of trying to become good at writing it, I built a library that gives you Regex in English.

Behold: Github RegExpBuilder

This .NET library creates a way to build up your pattern similar to how the LINQ extensions methods work. There are a lot of examples in the Test-library included in the Repo.

I did pick up som skills in how Regex works, but seriousley: Good Code is Simple Code

Which one of these snippets would you like to encounter within your source code:

var regEx = {(?:^)[A-Za-z]([A-Za-z]+|(?:\d+))(@{1,1})[A-Za-z]+(.{1,1})[A-Za-z]+(?:$)}


var builder = new Builder.RegExpBuilder();
var r = builder
     .Letter() // Must start with letter a-z
     .Letters() // any number of letters
     .Digits() // any number of numbers
     .Letters() // domain
     .Letters() // top-level domain

Both validates an email adress (something you should never do with Regex, because you won’t get it right, but anyway). Which one is the simplest? I rest my case.

If you like web development or .NET development, i’m on twitter and talks alot about development: @BigCheeseAnders