Oh dear. This browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Regular Expressions on the back of a Napkin @amandabee
random photo of a cocktail napkin

[abc]

A single character of: a, b, or c

 

^

Start of line

[^abc]

Any single character except: a, b, or c

 

$

End of line

[a-z]

Any single character in the range a-z

 

\A

Start of string

[a-zA-Z]

Any single char in the range a-z or A-Z

 

\z

End of string

(...)

Capture everything enclosed

 

.

Any single character

(a|b)

a or b

 

\s

Any whitespace character

a?

Zero or one of a (lazy)

 

\S

Any non-whitespace character

a*

Zero or more of a (greedy)

 

\d

Any digit

a+

One or more of a

 

\D

Any non-digit

a{3}

Exactly 3 of a

 

\w

Any word character (letter, number, underscore)

a{3,}

3 or more of a

 

\W

Any non-word character

a{3,6}

Between 3 and 6 of a

 

\b

Any word boundary

options: i case insensitive; m make dot match newlines; x ignore whitespace in regex; o perform #{...} substitutions only once

NAME: Sean Burnett POS: RP AGE: 30 WT: 200 BORN: Dunedin, FL SALARY: 2350000
NAME: Tyler Clippard POS: RP AGE: 27 WT: 200 BORN: Lexington, KY SALARY: 1650000
NAME: Ross Detwiler-Smith POS: SP AGE: 26 WT: 174 BORN: St. Louis, MO SALARY: 485000
NAME: Christian Garcia POS: RP AGE: 27 WT: 215 BORN: Miami, FL SALARY: N/A
NAME: Gio Gonzalez POS: SP AGE: 27 WT: 205 BORN: Hialeah, FL SALARY: 3335000
NAME: Mike Gonzalez POS: RP AGE: 34 WT: 215 BORN: Robstown, TX SALARY: N/A
NAME: Ryan P. Mattheus POS: RP AGE: 28 WT: 215 BORN: Sacramento, CA SALARY: 481000
NAME: Craig Stammen POS: RP AGE: 28 WT: 200 BORN: Coldwater, OH SALARY: 485000
NAME: Drew Storen POS: RP AGE: 25 WT: 180 BORN: Indianapolis, IN SALARY: 498750
NAME: Jordan Q. Zimmermann POS: SP AGE: 26 WT: 218 BORN: Auburndale, WI SALARY: 2300000
     
Sean Burnett, RP, 30, 200, Dunedin, FL, 2350000
Tyler Clippard, RP, 27, 200, Lexington, KY, 1650000
Ross Detwiler-Smith, SP, 26, 174, St. Louis, MO, 485000
Christian Garcia, RP, 27, 215, Miami, FL, N/A
Gio Gonzalez, SP, 27, 205, Hialeah, FL, 3335000
Mike Gonzalez, RP, 34, 215, Robstown, TX, N/A
Ryan P. Mattheus, RP, 28, 215, Sacramento, CA, 481000
Craig Stammen, RP, 28, 200, Coldwater, OH, 485000
Drew Storen, RP, 25, 180, Indianapolis, IN, 498750
Jordan Q. Zimmermann, SP, 26, 218, Auburndale, WI, 2300000
NAME: Sean Burnett POS: RP AGE: 30 WT: 200 BORN: Dunedin, FL SALARY: 2350000
NAME: Tyler Clippard POS: RP AGE: 27 WT: 200 BORN: Lexington, KY SALARY: 1650000
NAME: Ross Detwiler-Smith POS: SP AGE: 26 WT: 174 BORN: St. Louis, MO SALARY: 485000
NAME: Christian Garcia POS: RP AGE: 27 WT: 215 BORN: Miami, FL SALARY: N/A
NAME: Gio Gonzalez POS: SP AGE: 27 WT: 205 BORN: Hialeah, FL SALARY: 3335000
NAME: Mike Gonzalez POS: RP AGE: 34 WT: 215 BORN: Robstown, TX SALARY: N/A
NAME: Ryan P. Mattheus POS: RP AGE: 28 WT: 215 BORN: Sacramento, CA SALARY: 481000
NAME: Craig Stammen POS: RP AGE: 28 WT: 200 BORN: Coldwater, OH SALARY: 485000
NAME: Drew Storen POS: RP AGE: 25 WT: 180 BORN: Indianapolis, IN SALARY: 498750
NAME: Jordan Q. Zimmermann POS: SP AGE: 26 WT: 218 BORN: Auburndale, WI SALARY: 2300000
NAME: \w*
NAME: (\w*[-\w. ]*\w*[ ]*) Finished Version, Colorized!
310-808-5243
(415) 846-1688
(720) 318-9049
323.888.6200
323-888-6237
3238886209
323/888.6202
3237078576
3232162201
(323) 960-3100
727-455-4538
727-214-5862
7274555955
4242090017
^^ Crazy Mess of Phone Numbers
...playlist index:109 id:38522 title:Christmas in Heaven artist:B.B. King album:A Christmas Celebration of Hope playlist index:110 id:38523 title:I'll Be Home for Christmas artist:B.B. King album:A Christmas Celebration of Hope playlist index:111 id:38524 title:To Someone That I Love artist:B.B. King album:A Christmas Celebration of Hope playlist index:112 id:38525 title:Christmas Celebration artist:B.B. King album:A Christmas Celebration of Hope playlist index:113 id:38526 title:Merry Christmas, Baby artist:B.B. King album:A Christmas Celebration of Hope

playlist index:(\d+) id:(\d+) title:([\w\s',]+) artist:([\w\s'.]+) album:([\w\s']+?)(?=$|\splaylist)

XKCD on Regex

Use the spacebar or arrow keys to navigate