Skip to content

Instantly share code, notes, and snippets.

@dmpeters
Created February 11, 2013 21:39
Show Gist options
  • Save dmpeters/4757858 to your computer and use it in GitHub Desktop.
Save dmpeters/4757858 to your computer and use it in GitHub Desktop.
a simple regex table for later reference.
_Symbol_ _Description_
. Any single character
\d Any single digit
[A-Z] Any character between A and Z (uppercase)
[a-z] Any character between a and z (lowercase)
[A-Za-z] Any character between a and z (case-insensitive)
+ One or more of the previous expression (for example, \d+ matches one or more digits)
[^/]+ One or more characters until (and not including) a forward slash
? Zero or one of the previous expression (for example, \d? matches zero or one digits)
* Zero or more of the previous expression (for example, \d* matches zero, one or more than one digit)
{1,3} Between one and three (inclusive) of the previous expression (for example, \d{1,3} matches 1, 2, or 3 digits)
_Note_: Most of this table was stolen from "The Definitive Guide to Django: Web Development Done Right".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment