William Liu

Regular Expressions

Regular Expressions (aka regexes) represent patterns for matching text. Each character in a regular expression is either a metacharacter (having special meaning) or a regular character that has a literal meaning.

Metacharacter vs Regular Character

The regex a. is broken down into:

The above regex will match text like: a, ax, a0.

General Patterns

How is regex used?

Regex is used programs like grep (e.g. grep through some logs)

Vim

For example, with vim, you can start a search with / If you want to search for just the character a by itself, you can use \< and \> to run: /\<a\>