philipp:
Here's a Multi Line Regex for VSCode: [\s\S\n]+?
(Source). It comes in handy e.g. when you want to move stuff around in a file, and I use this a lot when refactoring my notes. Let's say you want to use the title
tag from your front matter as the first heading:
Example.md
:
---
someprop: "foo"
title: "My Title"
someotherprop: "bar"
andanotherprop: "baz"
---
This is my note, it started out without a H1, it should end up with one.
Use the Search function in VSCode, enable regex and enter this in the search field:
---
([\s\S\n]+?)
title: "(.*)"
([\s\S\n]+?)
---
Then enter this as a replacement:
---
$1
title: "$2"
$3
---
# $2
This transforms our Example.md
(and all other files) to this:
---
someprop: "foo"
title: "My Title"
someotherprop: "bar"
andanotherprop: "baz"
---
# My Title
This is my note, it started out without a H1, it should end up with one.
๐๏ธ Thu, May 1, 2025
ยท ๐
Last Update:
philippflenker.com was last updated .
๐พ