Re: RE: string search
| From: | Sheridan Saint-Michel | Date: | Mon, 16 Jul 2001 16:41:25 +0000 |
| Subject: | Re: RE: string search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58081@lists.php.net to get a copy of this message | ||
Couldn't he just do something like
if (strstr($text, "aol.com")) {
MyFunction();
} else {
echo "Not Found";
}
It just seems like using ereg for this is like killing a fly with a
sledgehammer
Sheridan
----- Original Message -----
From: scott [gts] <scott@graphictype.com>
To: php <php-general@lists.php.net>
Sent: Monday, July 16, 2001 10:59 AM
Subject: RE: [PHP] RE: string search
> read the docs for ereg... i hardly use it, so i dont know
> for certain if it will match. (althouth the use of "^" at
> beginning *and* end suggests that it wont do what you expect)
>
> preg will match "aol.com" with this regexp:
>
> preg_match('/aol.com/', $string )
>
>
> > -----Original Message-----
> > From: Joseph Bannon [mailto:JBannon@advparadigm.com]
> > Sent: Monday, July 16, 2001 11:49 AM
> > To: PHP (E-mail)
> > Subject: [PHP] RE: string search
> >
> >
> > Will this work?
> >
> > $string = "http://www.aol.com/";
> >
> > if (ereg ("^aol.com^", $string) {
> > }
> > else {
> > }
>
>
> --
> 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