Regular expressions

(click anywhere on page or use keyboard arrow to continue)

What is a regular expression?

Notation for describing a set of character strings

Examples
foo matches foo
[fb]oo matches foo and boo
fo* matches f, fo, foo, ...

Why is this useful?

Matching patterns to text lets you...

Places you might encounter regexes

Editors
vim, emacs, TextMate, Notepad++, ...
Languages
e.g. in R: grep, sub, gsub, regexpr
Utilities
grep, sed, awk, find, locate, ...

Regular expression: patterns

Regular expression: patterns

Escaping

Other things