note 71386 added to function.ereg
| From: | logic_trap at osu1 dot php dot net | Date: | Sat, 25 Nov 2006 20:33:59 +0000 |
| Subject: | note 71386 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120081@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 216.194.113.175
Probable Submitter: 67.9.131.9
----
Manual Page -- http://www.php.net/manual/en/function.ereg.php
Edit -- https://master.php.net/note/edit/71386
Del: integrated -- https://master.php.net/note/delete/71386/integrated
Del: useless -- https://master.php.net/note/delete/71386/useless
Del: bad code -- https://master.php.net/note/delete/71386/bad+code
Del: spam -- https://master.php.net/note/delete/71386/spam
Del: non-english -- https://master.php.net/note/delete/71386/non-english
Del: in docs -- https://master.php.net/note/delete/71386/in+docs
Del: other reasons-- https://master.php.net/note/delete/71386
Reject -- https://master.php.net/note/reject/71386
Search -- https://master.php.net/manage/user-notes.php