Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: Regex help.

  1. #16
    New Coder
    Join Date
    Apr 2010
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Exactly the same as Phil posted but changed the file name.
    PHP Code:
    <?php

    $file 
    "list.txt";
    $srt file_get_contents($file);
     
     
    $array preg_match_all("#<li><a\s+name=\"(?:[^\"]+)\"\s?>([^<]+)</a></li>#is"$str$matches);

     foreach( 
    $matches[1] as $key => $inner_text ) {
         
    $url_insert urlencode$inner_text );
         
    $str str_replace($matches[0][$key], "<li><a href=\"http://www.google.com.au/search?q=" $url_insert "\">" $inner_text "</a></li>"$str); 
     }
     
     
    $array preg_match_all("#<li>([^<]+)</li>#is"$str$matches); 
     
     foreach( 
    $matches[1] as $key => $inner_text ) {
         
    $url_insert urlencode$inner_text );
         
    $str str_replace($matches[0][$key], "<li><a href=\"http://www.google.com.au/search?q=" $url_insert "\">" $inner_text "</a></li>"$str); 
     }
     
     echo 
    $str;
     
    ?>

  2. #17
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    hehehe im a monkey

    $srt = file_get_contents($file);
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  3. #18
    New Coder
    Join Date
    Apr 2010
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Oh right! I hate it when it's the simple things.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •