Flagrant Badassery

A JavaScript and regular expression centric blog

RSS Feed for Regular ExpressionsRegular Expressions

Regular Expressions As Functions

Firefox includes a non-standard JavaScript extension that makes regular expressions callable as functions. This serves as a shorthand for calling a regex's exec method. For example, in Firefox /regex/("string") is equivalent to /regex/.exec("string"). Early ECMAScript 4 proposals indicated this functionality would be added to the ES4 specification, but subsequent discussion on the ES4-discuss mailing list [...]

Read More

10 Reasons to Learn and Use Regular Expressions

10. Regular expressions are everywhere Here's a short list of programming languages and tools that support regular expressions. The links are to their regex documentation. The .NET Framework ActionScript ColdFusion Java JavaScript Perl PHP Python Ruby Tcl Apache HTTP Server Google Analytics Google Code Search Yahoo! Pipes Microsoft Exchange Server Windows PowerShell OpenOffice.org Oracle Database Any decent programmer's text editor or IDE And thousands more… 9. Regular expression mastery can help you stand out from the crowd Regular [...]

Read More

Fun With .NET Regex Balancing Groups

The .NET Framework's regular expression package includes a unique feature called balancing groups, which is a misnomer since although they can indeed be used to match balanced constructs, that's not all they're good for and really has nothing to do with how they work. Unfortunately, balancing groups are quite poorly documented. Following is a brief [...]

Read More

Regex Legends: The People Behind the Magic

Many people have contributed to developing and promoting the use of regular expressions since they were invented about half a century ago. Here's a short list of some of the most influential people behind the technology. I've written this up for two reasons: For people who've only gotten into the technology recently but are interested in [...]

Read More

The terms single-line and multi-line considered harmful

Alright, that title doesn't really work, but one thing I've encountered quite frequently is that the terms "single-line mode" and "multi-line mode" seem to cause no end of confusion for the vast majority of regex users. Many guides try to explain the terms based on some description of lines, or other unrelated issues. I won't, [...]

Read More