Sign in Start free

2The dot and escaping

The dot matches any single character; a backslash turns a metacharacter back into text.

The dot . is a wildcard: it matches any one character except a line break. c.t matches cat, cot, cut, c t and even c9t – but not ct (nothing between) or coat (two characters between).

Because the dot is so greedy for anything, a pattern like file.txt also matches filextxt. When you mean a real dot, escape it: file\.txt.

PatternMatches
.any character except a line break
\.a literal dot
\\a literal backslash

Exercises