note 71386 deleted from function.ereg by tularis
| From: | tularis@php.net | Date: | Thu, 31 May 2007 13:19:55 +0000 |
| Subject: | note 71386 deleted from function.ereg by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127055@lists.php.net to get a copy of this message | ||
Note Submitter: logic_trap
----
This is pretty basic but not obvious if you're new to regx.
If you want to search for both single characters and strings try this:
// Single Characters: abc
// Enclose inside []
// String1: http://
// Enclose inside ()
// String2: com
// Enclose inside ()
//
// Separate sections with |
//
$haystack="http://www.whatever.com";
if (eregi("([abc])|(http://)|(com)", $haystack)) {
echo true;
} else {
echo false;
}