4 February 2024

The following snippet employs a PCRE (Perl Compatible Regular Expressions) pattern to specifically identify and match self-closing HTML tags.

This pattern breaks down as follows:

  • < and >: Match opening and closing angle brackets.
  • [^>]+: Match one or more characters that are not the closing angle bracket >.
  • \/: Match the forward slash indicating the self-closing tag.
Source code viewer
  1. <[^>]+\/>
Programming Language: PCRE