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" <[EMAIL PROTECTED]> 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"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: php-list- > [EMAIL PROTECTED]> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: php-list- > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]