Javascript RegExp: Searching for everything wrapped with a spezific char or string

  html, javascript, markdown, regex, showdown

I am writing a blog and use markdown language for the entered content to render. Now I try to filter everything outside of code-blocks (marked with triple back-ticks) for HTML-Tags and want to replace them.
However, my current RegExp Pattern isn’t working properly, and considering, that I am new to RegExp, i can’t find my issue, here is the Pattern I use:

/```(.*)```/g

This works just fine, If I want to strip apart every match, but when I want to split the text, according to this pattern, JavaScript is just looking for the triple back-ticks and not the whole Pattern.

Source: Ask Javascript Questions

LEAVE A COMMENT