Regular Expressions 101

Community Patterns

Regex for html heading to get only text

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?!>)([^><]+)(?=<\/h[0-9]>)
/
gm

Description

<h1 id="![alt-text](https://assets.breatheco.de/apis/img/images.php?blob&amp;random&amp;cat=icon&amp;tags=breathecode,32)--the-instagram-photo-feed"><img alt="alt text" src="https://assets.breatheco.de/apis/img/images.php?blob&amp;random&amp;cat=icon&amp;tags=breathecode,32" class="MDImg"> The Instagram Photo Feed</h1>
Submitted by pwdmad - 2 years ago