Home / APIs / _get_wptexturize_split_regex() – Retrieve the combined regular expression for HTML and shortcodes.

You appear to be a bot. Output may be restricted

Description

Retrieve the combined regular expression for HTML and shortcodes.

Usage

$string = _get_wptexturize_split_regex( $shortcode_regex );

Parameters

$shortcode_regex
( string ) optional – The result from _get_wptexturize_shortcode_regex(). Optional.

Returns

string The regular expression

Source

File name: wordpress/wp-includes/formatting.php
Lines: 1 to 29 of 29

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;
}
 

 View on GitHub View on Trac

Related

Published: 13 March 2017 | Last updated: 13 March 2017

Information

Function name: _get_wptexturize_split_regex
Plugin ref: WordPress
Version: 5.0.3
Sourcefile: wp-includes/formatting.php
File ref: wp-includes/formatting.php
API type: private
Deprecated?: No
API Letters: _,G,R,S,W

  • Plugins
  • Themes
  • Blocks
  • Shortcodes
  • APIs
  • Files
  • Hooks
  • Classes
  • Sites
  • Sitemap
  • Blog
oik-plugins Jetpack a2z
Jetpack a2z

Site:  jetpack.wp-a2z.org
© Copyright oik-plugins 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins