How can I apply regular expression to filter a string

How can I apply regular expression to filter only

 

from the following string

Read More
Is simply dummy text of the printing and typesetting industry. 

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

or Without using regular expression and Dom is there anyways to get the same

Related posts

Leave a Reply

3 comments

  1. That’s a shortcode and you can easily use the WordPress Shortcode API to handle those shortcodes:

    function video_shortcode( $atts, $content = null ) {
      // do whatever you want to to
    }
    add_shortcode('video', 'video_shortcode');
    

    In the $atts array you will have a list of all of your attributes from the video shortcode:

    array(
        "src" => "http://duel.evotechaustin.com/wp-content/uploads/2010/09/kramer.m4v",
        "width" => "480",
        "height" => "360",
        "id" => "b-test",
        "class" => "player"
    )
    
  2. preg_match("/[video[^]]+]/i", $subject, $matches);
    

    $matches[0] contains

    [video src="http://duel.evotechaustin.com/wp-content/uploads/2010/09/kramer.m4v" width="480" height="360" id="b-test" class="player"] 
    
  3. Use substring and indexOf

    for example,

    htmlString = document.getElementById('div').innerHtml();
    startIndex = htmlString.indexOf("[video");
    endIndex = htmlString.indexOf("]", startIndex);
    output = htmlString.substring(startIndex, endIndex);