Whether you’re aware of it or not I love using regular expressions. Something about it just gives me an extra sense of satisfaction and security. However, often I use them on the server side more often than client side for the simple fact that for critical applications it’s more reliable considering the client can opt to turn off javascript. That being said though it is always a nice feature to spice things up with javascript validation, or just extra functionality by parsing strings and what not.

One big feature I miss with javascript regular expressions are named captures. Most serverside languages make use of these very well. After some digging around it appears there is a nice library called XRegExp which corrects this problem, as well as a few others. Check out this quick example (note that I’m using console.log to view the results with Firebug):

var test = '9test and another 8Test, then tset and 7test again.  teSt or tesT Test.';
var parser = XRegExp("(?<tname> Test)");
var parts = parser.exec(test);


There’s also a good bit more functionality with this plugin, so I won’t waist your time here. Head on over and check it out.