note 68198 added to function.fnmatch
| From: | soywiz@php.net | Date: | Tue, 18 Jul 2006 02:12:05 +0000 |
| Subject: | note 68198 added to function.fnmatch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114865@lists.php.net to get a copy of this message | ||
A better "fnmatch" alternative for windows that converts a fnmatch pattern into a preg
one. It should work on PHP >= 4.0.0
<?php
if (!function_exists('fnmatch')) {
function fnmatch($pattern, $string) {
return @preg_match('/^' . strtr(addcslashes($pattern,
'\\.+^$(){}=!<>|'), array('*' => '.*', '?' =>
'.?')) . '$/i', $string);
}
}
?>
----
Server IP: 130.206.1.5
Probable Submitter: 81.202.127.50
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.fnmatch.php
Edit -- http://master.php.net/note/edit/68198
Del: integrated -- http://master.php.net/note/delete/68198/integrated
Del: useless -- http://master.php.net/note/delete/68198/useless
Del: bad code -- http://master.php.net/note/delete/68198/bad+code
Del: spam -- http://master.php.net/note/delete/68198/spam
Del: non-english -- http://master.php.net/note/delete/68198/non-english
Del: in docs -- http://master.php.net/note/delete/68198/in+docs
Del: other reasons-- http://master.php.net/note/delete/68198
Reject -- http://master.php.net/note/reject/68198
Search -- http://master.php.net/manage/user-notes.php