Write a test, because sometimes you are a moron.
The other day I was working with Javascript and regexes:
var url=’http://www.example.com/path?parameter=value+with+old+school+spaces’; reg = /+/g; alert(url.replace(reg,’%2B’));
I spent a good 15 minutes trying to figure out why this wasn’t working… Actually, it does work, but because when you display anything in an alert window, it all gets decoded. So, my first attempt was correct, I just […]