Re: search string

From: Date: Mon, 16 Apr 2001 01:20:27 +0000
Subject: Re: search string
Groups: php.general 
Request: Send a blank email to php-general+get-48684@lists.php.net to get a copy of this message
Even better, try strstr...it'll be faster than a regexp for a simple search of a string for another string. -jack ----- Original Message ----- From: "Tobias Talltorp" <tobias@talltorp.com> Date: Sunday, April 15, 2001 7:20 pm Subject: Re: [PHP] search string > I think you want regular expressions... > > Try this on for size: > $str = "http://www.yahoo.com/somedir/somepage.html"; > > if (preg_match("/www.yahoo.com/i", $str)) { > print "Your submission cannot be accepted"; > } else { > print "You are good"; > } > > If you want to read up on regular expressions: > http://www.php.net/manual/en/ref.pcre.php (Faster than ereg) > http://www.php.net/manual/en/ref.regex.php > > // Tobias Talltorp > > > ""Joseph Bannon"" <joseph@iwebsitesoftware.com> wrote in message > > news:NEBBJPFPMLBIJMIFFHFJMELHCMAA.joseph@iwebsitesoftware.com... > > What is the function to search a string? Basically, I want > search a string > > (a url) to see if it has "www.yahoo.com" in it and if yes, tell > the user > > their submission cannot be accepted. > > > > J > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list- > admin@lists.php.net> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list- > admin@lists.php.net >

« previous php.general (#48684) next »