Re: preg_match() error!!

From: Date: Sat, 19 Aug 2000 11:02:25 +0000
Subject: Re: preg_match() error!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12581@lists.php.net to get a copy of this message
Thomas Edison Jr. writes: > I'm using a script that uses the preg_match() > function. The script is running perfectly fine on my > personal web server which has PHP4 installed, however, > it is gving an "call to unsupported function" error > for preg_match() on my main server which has PHP3 > installed. Is compatibility of preg_match() different > in PHP3 & PHP4? > > The line in the script using the function is : > > if (preg_match('/^<p><A HREF=/', $tmp)) { > > any suggestions? > > Regards, > T. Edison jr. Unless you can install a more recent PHP3 or PHP4, you could use the POSIX regular expression functions: see ereg() at http://www.php.net/manual/function.ereg.php But the line shown doesn't need a regex; it would be enough to use strpos(). This line is functionally equivalent to what you have above (i.e., matches '<p><A HREF=' at the beginning of a string): if (strpos("X$tmp", '<p><A HREF=') == 1) { Cheers, Torben -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#12581) next »