Deleting all lines that match a pattern in vi

In vi, to delete all the lines that contain, say, 'error':


If you want to, say, delete all lines beginning with a pound sign (#) -- that is, remove all the comments -- you need to escape the caret (^) which denotes the beginning of the line, as well as the pound sign itself, like so:


While this would seem to be a common activity in vi, it was incredibly hard to find documentation about it, despite Google and all the books I have that cover vi. IBM to the rescue: I found this concise page that told me exactly what I wanted:>/a>