SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    933
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Arrow pregmatch() question?

    I have these codes below,

    Code:
    <?php
    //include methods/class
    include_once 'simple_html_dom.php';
    include_once 'casting.inc.php';
    
    
    // Create DOM from URL
    $url = "http://sampledomain.org/tlg/";
    $html = file_get_html($url);
    
    // Find all links
    // connect exact url and make it live link
    foreach($html->find('a') as $element) {
    	#echo "<b>" . $element->href . "</b><br>"; 
    	
    	//check if href has /html/ if yes then connect right live url
    	if(preg_match("/tlg/", $element->href)) {
    		if(preg_match("/html/", $element->href)) {
    			$atlanta_url['url'] = $element->href;
    			echo $atlanta_url['url'] ."<br>";
    		}
    	}
    
    }
    
    		 
    ?>
    The result of that codes you will see below,
    http://czone01.com/onstaged/scrape_craig_old.php

    I don't understand why these strings below, still included?
    rose1.2515
    daisy0.7525
    orchid1.157

    It suppose to be excluded since the pregmatch() should limit that.

    Anybody would like to help me figure that out please?

    Is this a pregmatch() flaw?

    Thanks in advance.
    Last edited by solidcodes; May 25, 2009 at 20:30. Reason: typographical error.


Bookmarks

Posting Permissions

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