Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(#.*) &(.*)
/
gm

Description

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)