$foo =~ m/^(F|f)oo\s*(B|b)ar$/
$foo =~ s/foo bar/bas bat/
$foo =~ tr/[a,e,i,o,u]/[A,E,I,O,U]/
An "i" at the end of the expression makes it case insensitive.
$bar =~ m/foobar/i
Do not match:
$bar !~ m/foobar/i
Group with parents like:
if($string =~ m/(J|j)ohn (S|s)mith/) {print "I found John!\n"}
Class groupings are with brackets like:
tr/[a-z]/[A-Z]
^ Match beginning of string
$ Match end of string
. Match any character
\w Match "word" character (alphanumeric plus "_")
\W Match non-word character
\s Match whitespace character
\S Match non-whitespace character
\d Match digit character
\D Match non-digit character
\t Match tab
\n Match newline
\r Match return
\f Match formfeed
\a Match alarm (bell, beep, etc)
\e Match escape
\021 Match octal char ( in this case 21 octal)
\xf0 Match hex char ( in this case f0 hexidecimal)
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
Magic characters like ^ can be escaped if you're looking for a literal like \^.
$1, $2, $3, contain the first, second, thing matches.
$& contains the entire match.