The JavaScript RegEx API

Regular Expressions are about as elegant as a pig on a bicycle. Using a regular expression feels like resorting to machine code when all those patterns we’re taught to love just aren’t up to the job. Which, I suppose, is also a reason to like them. They have a brute force directness, free from pattern politics and endless analysis.

And they work. Eventually.

If the JavaScript Regular Expressions API makes your head spin then this might be for you. I’ll document the basics and demonstrate how you might use them to full effect.

For the sake of brevity (not to mention my own lack of regex proficiency) I won’t discuss the syntax of the expressions themselves. Suffice to say, JavaScript regEx syntax is Perl based. There are many excellent online resources for this, as well as some nice online RegEx testers.
Continue reading