The web design and pages for my personal website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 B

Regexp Basics

A small reference for some basic things you can do with regular expressions that you can get a lot of mileage out of without getting too in the weeds with crazy features.

Recommended links:

  • Regexr, an interactive regexp explorer.
  • perlretut, where I learned regexp back in the day. It's Perl documentation but the regexp knowledge inside is universally applicable to other programming languages.

This page includes examples and code snippets in various programming languages.

String Search (& Replace)

The simplest regexps deal with just plain old raw text.

// JavaScript
"Hello world".match(/world/);
# Perl
"Hello world" =~ /world/;
# Python
import re
re.match(r'world', "Hello world")