Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?(DEFINE) (?<void>br|img|area|base|col|command|embed|hr|input|keygen|link|meta|param|source|track|wbr|!DOCTYPE) (?<any>[^<>]*+) ) <div \s class="card"> (?P<pair> (?&any) (:? <(?P<v_tag>(?!\/)(?&void))(?&any)> (?:(?&pair) | (?&any))*+ (<\/(?P=v_tag)>)? | <(?P<tag>(?!\/)[^<> ]++)(?&any)> (?:(?&pair) | (?&any))*+ <\/(?P=tag)> ) (?&any) )* <\/div>
/
gmx

Description

This regular expression can be used to verify html (by removing the anchor before pair), as well as extract elements of html (specify elements before the pair).

Submitted by Yubo - 2 years ago