Regular Expressions 101

Community Patterns

Take specified main tag and children tags plus contents between children except HTML

0

Regular Expression
PCRE (PHP <7.3)

/
(<phx:element.[^>]+?[^\/]>)(.*?)(<\/phx:element>)|(<phx:.+?>)|(<\/phx:\w+>)
/
gsi

Description

First matches the children specified opened or self-closed tags and their contents. If not found, matches opening tag. If not found, matches closing tag.

Submitted by anonymous - 5 years ago