Page 1 of 1

pregmatch() question?

Posted: Mon May 25, 2009 10:28 pm
by wren9
I have these codes below,

Code: Select all

 
<?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.

Re: pregmatch() question?

Posted: Tue May 26, 2009 3:24 am
by jmut
I suggest you give simple string , tell us what pattern you look for and your try code. This way you'll get much better response.
Cheers

Re: pregmatch() question?

Posted: Tue May 26, 2009 3:34 am
by prometheuzz
wren9 wrote:....

Is this a pregmatch() flaw?

...
I don't understand you question, but it is highly unlikely that someone not familiar with regular expressions (you in this case) finds a bug in PHP's preg_match function. So, could you explain your problem without me needing to some external url in order to see what's going wrong?

Good luck.