_get_wptexturize_split_regex
Retrieve the combined regular expression for HTML and shortcodes.
Description
(string) _get_wptexturize_split_regex( (string) $shortcode_regex = '' );
Returns (string)
The regular expression
Parameters (1)
- 0. $shortcode_regex — Optional. (string) =>
''
- The result from
_get_wptexturize_shortcode_regex(…)
. Optional.
Usage
if ( !function_exists( '_get_wptexturize_split_regex' ) ) { require_once ABSPATH . WPINC . '/formatting.php'; } // The result from _get_wptexturize_shortcode_regex(). Optional. $shortcode_regex = ''; // NOTICE! Understand what this does before running. $result = _get_wptexturize_split_regex($shortcode_regex);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/formatting.php
- function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
- static $html_regex;
- if ( ! isset( $html_regex ) ) {
- $comment_regex =
- '!' // Start of comment, after the <.
- . '(?:' // Unroll the loop: Consume everything until --> is found.
- . '-(?!->)' // Dash not followed by end of comment.
- . '[^\-]*+' // Consume non-dashes.
- . ')*+' // Loop possessively.
- . '(?:-->)?'; // End of comment. If not found, match all input.
- $html_regex = // Needs replaced with wp_html_split() per Shortcode API Roadmap.
- '<' // Find start of element.
- . '(?(?=!--)' // Is this a comment?
- . $comment_regex // Find end of comment.
- . '|'
- . '[^>]*>?' // Find end of element. If not found, match all input.
- . ')';
- }
- if ( empty( $shortcode_regex ) ) {
- $regex = '/(' . $html_regex . ')/';
- } else {
- $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
- }
- return $regex;
- }