Skip to content
FLAVIO COPES
flaviocopes.com
2026

regex select entire line starting with..

By Flavio Copes

Learn how to use a regex like ^booktitle:.* in VS Code to select an entire line starting with a given prefix, then delete it by replacing with nothing.

~~~

Had a bunch of markdown files with a frontmatter property I didn’t need any more, so I used this search expression in VS Code with regex enabled to find all lines starting with booktitle: and removed the entire line using replace with an empty string:


^booktitle:.*

VS Code search and replace panel with regex pattern ^booktitle:.* in the search field

~~~

Related posts about vscode: