I am trying to use the Select-String Cmdlet to get all lines between the --- markers. Here's an example file:
---
layout: layouts/blog.njk
title: "Post #1"
date: "2022-01-03"
author: Stefan Greve
description: Simple test description which serves as a summary of this whole article.
headers: ["Header 1", "Header 2", "Header 3", "Header 4"]
latex: true
status: private
---
<h2 id="header-1">Header 1</h2>
<p>
This is just a small test post for {{ title }} with some <code>print('test')</code> code.
</p>
I have used this regex tester site to test the pattern ---(\n|.)*?--- (which works with the .NET flavor). But when I use the pattern in PowerShell,
$Content = Select-String -Path $p -Pattern "---(\n|.)*?---" -AllMatches
it doesn't work. Any ideas why this could be the case? Regex isn't really my strong suit... 