Saturday, May 12, 2012

The Regular Expression Skidmarklet (Prepare for much boy poo humor as you learn RegEx)

CodeProject - The Regular Expression Skidmarklet

"Regular expressions are hard. Reading about them is confusing and boring at best. Until you need the functionality they provide it’s hard to understand why they exist. You need to apply them to something you do everyday.

Following these lessons you’ll be taken through the assembly of a Skidmarklet... a JavaScript Bookmarklet that leverages Regular Expression matching and replacement to skidmark the crappy parts of any web page. Think about it this way, Regular expressions (or regex) are hard, everybody poops and we can all relate to that.

Click the button below to see the finished product in action or download the example files here.

Background

Recent forays into fatherhood have revitalized my once rampant infatuation with poop. So let’s make my poop obsession your regular expression!

I developed the poop game when I was 17 working at Blockbuster Video. Don’t worry, it happened in the store not the toilet. For fun between the postal monotony of shelving cassette tapes I swapped poop for each word in a movie title. Using The Green Mile as an example there were three potential poop game results:

  1. Poop Green Mile
  2. The Poop Mile
  3. The Green Poop

One word at a time I’d just laugh at all the possible combinations and one word at a time customers would distance themselves from my creepy giggles as this all happened in my head. Here poop made a crappy job a little less of a turd. Regular Expressions have the power to smear joy and delight if only we can understand them. So let’s get to know them better by playing the poop game on the internet.

..."

This had the boy, okay the man too, in me laughing as I was learning...

No comments: