Regular Expressions 101

Community Patterns

MD h1 change to block with anchor


Regular Expression
PCRE2 (PHP >=7.3)

(#.*) &(.*)


Find any lines starting with # and followed by anchor name with & and wrap it into html so that we start with this:

Title &anchor

and finish with something like this:

<a name = "anchor"> # Title <a href = "link/#anchor">→</a>
Submitted by anonymous - 3 years ago (Last modified 3 years ago)