regex – Regular Expressions

Every programmer should learn to use these, but approach them with the respect of learning another programming language, because that’s really what they are. Get a good book.

There are two popular regex styles:

PCREs in some form are used natively in some languages, e.g.:

Beware that even PCREs amongst languages have slight feature differences and quirks:


PCRE basics:


Notes on Bash

Bash globbing (filename expansions) look similar to regex but are not. They are still very useful:



Globbing. Regular Expressions. Advanced Bash-Scripting Guide.

Filenames and Pathnames in Shell: How to do it Correctly. David A. Wheeler. 2016-05-04.

Perl Style Regular Expressions in Prolog. Robert D. Cameron. CMPT 384 Lecture Notes. 1999.

Regular Expression. Wikipedia.

RegExp. MDN.

RegExp lookbehind assertions. Yang Guo. V8 JavaScript Engine. 2016-02-26.