BASICS

Matching literal text

The simplest pattern is the literal text you want to find.

The pattern cat finds the three characters c, a, t in a row. Most characters mean exactly themselves - you type the text you are hunting for and the engine finds every place it appears. A few characters are special instead: they are called metacharacters (like ., *, ?) and stand for a rule rather than themselves. To match one of those literally, you escape it, covered later.

A pattern matches anywhere inside the text, so cat also matches the middle of "concatenate". Limiting matches to whole words comes later. (These drills always match globally - every occurrence is highlighted.)

PRACTICE - 2 DRILLS 0/2 DONE
DRILL 1/2

Match every occurrence of the word cat, including when it sits inside a longer word.

/ /
my cat sleeps all day
must match: "cat"
concatenate the strings
must match: "cat"
cat catalog cathedral
must match: "cat" "cat" "cat"
a dog barks
must match nothing
DRILL 2/2

Match every occurrence of art, including when it is buried inside a longer word.

/ /
the art of war
must match: "art"
depart from the start
must match: "art" "art"
a smart cart
must match: "art" "art"
no match line
must match nothing