Regular Expressions 101

Community Patterns

Fix markdown image in header

1

Regular Expression
PCRE2 (PHP >=7.3)

/
([#]+)\s*([^!]*)\s*(!\[.*\].*\))([^\n]*)
/
gm

Description

I was converting from markdown to another format & it didn't allow images in headers so this Regex finds an image in a header & moves it before the header.

Submitted by thefinnomenon - a year ago