Activity Stream
48,167 MEMBERS
62007 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 8 of 8
  1.     
    #1
    Member
    Website's:
    premium-links.net wanted-programs.com

    Default php help regex!

    i have to do a simple work

    i have to find all <youtube>v=xxxxxx</youtube> in post of a wordpress

    and replace then custom way!

    Code: 
    function the_content($more_link_text = null, $stripteaser = 0) {
        $content = get_the_content($more_link_text, $stripteaser);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        
        preg_match_all('#<youtube>(.*?)</youtube>#i', $content, $link_matches);
        if (count($link_matches) > 0){
            foreach ($link_matches as $link_value){
                echo $link_value;
    
            }
                  
        }
        
        
        return $content;
    }
    this function is in post-template.php in wp-include folder.

    pls help!
    ?RaJ? Reviewed by ?RaJ? on . php help regex! i have to do a simple work i have to find all <youtube>v=xxxxxx</youtube> in post of a wordpress and replace then custom way! function the_content($more_link_text = null, $stripteaser = 0) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content', $content); Rating: 5

  2.   Sponsored Links

  3.     
    #2
    It begins...
    Post the output of:

    PHP Code: 
        print_r($link_matches); 

  4.     
    #3
    Member
    Website's:
    premium-links.net wanted-programs.com
    (
    [0] =&gt; Array
    (
    [0] =&gt; <youtube>1</youtube> [1] =&gt; <youtube>100</youtube> [2] =&gt; <youtube>1000</youtube> [3] =&gt; <youtube>10000</youtube> [4] =&gt; <youtube>100000</youtube> [5] =&gt; <youtube>1000000</youtube> [6] =&gt; <youtube>10000000</youtube> [7] =&gt; <youtube>100000000</youtube> )
    [1] =&gt; Array
    (
    [0] =&gt; 1
    [1] =&gt; 100
    [2] =&gt; 1000
    [3] =&gt; 10000
    [4] =&gt; 100000
    [5] =&gt; 1000000
    [6] =&gt; 10000000
    [7] =&gt; 100000000
    )
    )
    The message you have entered is too short. Please lengthen your message to at least 8 characters.

  5.     
    #4
    Member
    Website's:
    premium-links.net wanted-programs.com
    is there something wrong with regex?

  6.     
    #5
    Member
    Website's:
    ExploringPC.com DedicatedSeedboxHosting.com
    Bro, I can't use regex, if you want, I can code it my way. Will use String Tokenizer.

  7.     
    #6
    Member
    Website's:
    premium-links.net wanted-programs.com
    fixed it guys sorry for the trouble

  8.     
    #7
    Member
    Website's:
    Tastro.org HDTVXviDLOL.com EpisodeSeasons.com FileBorg.org W-47.com
    change this:

    preg_match_all('#<youtube>(.*?)</youtube>#i', $content, $link_matches);

    to this:

    preg_match_all('#<youtube>(.*?)<\/youtube>#i', $content, $link_matches);

    if it still won't work... then post the error which you get.
    LE with your pr2 site? <a href="http://tastro.org/">Tastro.org</a> or link exchance with our category page: <a href="http://tastro.org/i/hdtv">HDTV</a> | <a href="http://tastro.org/i/dvdrip">DVDRip</a> | <a href="http://tastro.org/i/r5">R5</a> | <a href="http://tastro.org/i/bdrip">BDRip</a> | <a href="http://tastro.org/i/brrip">BRRip</a>

  9.     
    #8
    Member
    Website's:
    ExploringPC.com DedicatedSeedboxHosting.com
    Raj solved it. Apparently he was stuck in a loop. Happens to all of us.
    Best of luck with your project mate.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Regex in shell
    By mahjong in forum Server Management
    Replies: 0
    Last Post: 8th Apr 2012, 08:58 AM
  2. Need help with RegEx
    By dima1236 in forum Web Development Area
    Replies: 7
    Last Post: 14th Jan 2012, 05:53 PM
  3. Need help with Regex - VB.NET
    By Connor in forum Web Development Area
    Replies: 2
    Last Post: 27th Sep 2011, 05:11 PM
  4. Help with Regex
    By ChaoscripT in forum Web Development Area
    Replies: 2
    Last Post: 15th Dec 2010, 09:26 PM
  5. need help with some regex
    By t3od0r in forum Web Development Area
    Replies: 1
    Last Post: 13th Aug 2010, 04:23 PM

Tags for this Thread

BE SOCIAL