Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
<a[^>]*?href=(?|"([^"]*?)"|'([^']*?)').*?>(.*?)<\/a>
/
gsi

Description

Extracts the href and title values from an anchor tag to be placed into an inline Markdown link.

Submitted by Mike Johnson - 11 years ago