_get_wptexturize_split_regex

The timeline below displays how wordpress function _get_wptexturize_split_regex has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @param string $shortcode_regex Optional. The result from _get_wptexturize_shortcode_regex().
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
        // phpcs:enable
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}

WordPress Version: 5.5

/**
 * Retrieve the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex(). Optional.
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
        // phpcs:enable
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}

WordPress Version: 5.4

/**
 * Retrieve the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @staticvar string $html_regex
 *
 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex(). Optional.
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
        // phpcs:enable
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}

WordPress Version: 5.1

/**
 * Retrieve the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @staticvar string $html_regex
 *
 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
        // phpcs:enable
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}

WordPress Version: 4.9

/**
 * Retrieve the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @staticvar string $html_regex
 *
 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}

WordPress Version: 4.4

/**
 * Retrieve the combined regular expression for HTML and shortcodes.
 *
 * @access private
 * @ignore
 * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap.
 * @since 4.4.0
 *
 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
 * @return string The regular expression
 */
function _get_wptexturize_split_regex($shortcode_regex = '')
{
    static $html_regex;
    if (!isset($html_regex)) {
        $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?';
        // End of comment. If not found, match all input.
        $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')';
    }
    if (empty($shortcode_regex)) {
        $regex = '/(' . $html_regex . ')/';
    } else {
        $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
    }
    return $regex;
}