I want to act on markdown strings depending on whether they start with one, two or no #, but I am failing to rule ## out for being recognized as a title:
let strings = ["# Fancy Title", "## Fancy Subtitle", "Body Content")
for string in strings {
if string.contains(/^#(^#)/) { //string should only contain **one** #, but `strings[0]` falls through now …
// parse title
} else if string.contains(/^##/) {
// parse subtitle
} else {
// parse body
}
}
How do I properly exclude ## in my first if stmt?