wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_tag_regex › WordPress Function

Desde3.6.0
Obsoleton/a
get_tag_regex ( $tag )
Parâmetros:
  • (string) $tag An HTML tag name. Example: 'video'.
    Required: Yes
Retorna:
  • (string) Tag RegEx.
Definido em:
Codex:

Returns RegEx body to liberally match an opening HTML tag.

Matches an opening HTML tag that: 1. Is self-closing or 2. Has no body but has a closing tag of the same name or 3. Contains a body and a closing tag of the same name Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML


Fonte

function get_tag_regex( $tag ) {
	if ( empty( $tag ) ) {
		return '';
	}
	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
}