Re: Help with Strings Please

From: Date: Tue, 31 Aug 2004 13:44:02 +0000
Subject: Re: Help with Strings Please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195276@lists.php.net to get a copy of this message
Nick Wilson wrote:
Hi, I have a string like this, read from an html file: ' VALUE="16">' The value could be any number. I am trying to get that number. I have this so far, i was hoping someone might tell me how to get that number: <?php $handle = fopen("page.php", "r"); while (!feof($handle)) {
    $buffer .= fgets($handle, 4096);
} fclose($handle); $result = stristr($buffer, 'NAME="c"'); print ("Result:<br />".$result); ?> Im not very good at regex, is there an function that would help me? (couldnt see one...) thx...
preg_match('/value\s*=\s*"([0-9]+)"/i', $buffer, $result); print ("Result:<br />".$result[1]);

« previous php.general (#195276) next »