Author image

Regular Expression tutorial


Regular expressions are sequences of characters and symbols to be searched for (CTRL + F) within a longer piece of text.

Here I summarize my personal notes on regexps, awk, sed, grep and C++ regexps, Java regexps, Python regexps, Bash (linux shell) regexps, Javascript (regexps), PHP (regexps) etc.

For example to create a pattern that matches only the numbers out of this character sequence: 917-555-1234 and 646.867-5309 stop it!

use \d{3}[-.]\d{3}[-.]\d{4}

in PCRE regexp dialect.

But what are all these cryptic runes and sequences? Let's find out. Read on!

Meta Characters

  • \g : global matching, matches found in entire text
  • \G : matches the end of previously...

1