Make a regex for this...

I started this blog as more of a generic overall view of coding, more perspective on higher level ideas rather than line by line code (though I suspect I'll post some of that too) mostly because of how much time I spend on StackOverflow.  I figure, if you need an example of some bit of code, you can find it there, or other places on the net.

This post is inspired by about 50% of the questions I see on StackOverflow which are extremely easy to answer, because they start with "How do I make a regular expression for" and then some random bit of text. I have some decent scoring answers on these because I can answer them in just a couple of minutes with my trusty internet.  So here's a couple of my favorite resources.

First, get a bit of the basics of Regular Expressions down, use, it's a great site with the best detail in explaining Regular Expressions I've ever seen.  Then, make sure you have a decent test client.  For almost all examples, Rubular is my tester of choice, plus it's written in Ruby which is just awesome.

So that's it, read through the tutorials on, and plop the sample text into Rubular, and spend a few minutes making all the highlights work right and you usually have the answer to the question, and you can permalink the test sample for them.  I might write a bot to do this.


Popular Posts