I want to extract a YAML block from a string. This block is not of typical YAML, and starts and ends with ---
. I want the text in between these markers without the markers themselves. Below is a testing string (swift 4):
let testMe = """
---
# Metadata
title: hum
author: jecatatu
email: jecatatu@gmail.com
---
This is more text outside the yaml block
"""
In pure regex the pattern would be ---([\s\S]*?)---
. My initial thought, since I am a beginner was to use VerbalExpressions, but I couldn't reproduce this pattern using Verbal Expression. The closest I got was:
let tester = VerEx()
.find("---")
.anything()
.find("---")
How do I extract anything in between (but without) --- from a string using regex in Swift?