get_tag_regex()
Returns RegEx body to liberally match an opening HTML tag.
Matches an opening HTML tag that:
- Is self-closing or
- Has no body but has a closing tag of the same name or
- 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
Хуков нет.
Возвращает
string. Tag RegEx.
Использование
get_tag_regex( $tag );
- $tag(строка) (обязательный)
- An HTML tag name. Example:
'video'.
Список изменений
| С версии 3.6.0 | Введена. |
Код get_tag_regex() get tag regex WP 7.1.5
function get_tag_regex( $tag ) {
if ( empty( $tag ) ) {
return '';
}
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
}