Re: RegEx

From: Date: Wed, 10 Nov 2004 10:13:35 +0000
Subject: Re: RegEx
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-37218@lists.php.net to get a copy of this message
Yemi Obembe wrote:
i'd luv to know wat happens if a value is to be taken from within a certain tag in a page when there are more than one of the tags in the page. for example, if i'd luv to tkae all data from within EVERY bold tags in a page, will this work:
you have to tell the regex to be ungreedy
$file = http://example.com/; $open = fopen($file,"r"); $read = fread($open, filesize($file)); $search = eregi("<b>(.*)</b>", $read, $value);
also: "Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg()." preg_match( "/<b>(.*)</b>/Ui", $read, $value ); http://www.php.net/preg_match
and by the way, i'd also luv to know more about Regular Expressions. I'd be very happy if someone can refer me to a nice tutor page. thanx.
http://weitz.de/regex-coach/ -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet

« previous php.db (#37218) next »