Re: RegEx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux