Ranges and Patterns

Where the change lands

The part before s is the range:

RangeMeans
:sthis line only
:%sthe whole file
:10,20slines 10 to 20
:.,+5sthis line and the next five
:.,$shere to the end
:'<,'>sthe visual selection
:'a,'bsbetween marks a and b
:g/pat/severy line matching pat

Matching exactly what you mean

:%s/\<total\>/subtotal/g

\< and \> are word boundaries. Without them, total also matches inside subtotal and totals — and if the replacement contains the original, the substitute can start matching its own output.

Other useful pieces:

PatternMatches
\d\+one or more digits
\s*any run of whitespace
^ / $start / end of line
.\{-}non-greedy “as few as possible”
\(...\)a capture group

Case

\c anywhere in the pattern forces case-insensitive; \C forces case-sensitive — regardless of your ignorecase setting.