note 69006 added to function.ereg
| From: | theppg_001 at hotmail dot com | Date: | Sat, 19 Aug 2006 14:00:34 +0000 |
| Subject: | note 69006 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116089@lists.php.net to get a copy of this message | ||
Ok well someone else posted this but if didn't work so I made my own.
I used this to check file names that are to be created on a server.
File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will
be accepted.
File names beginning with anything but a-Z or 0-9 will be rejected.
File names containing anything other than above mentioned will also be rejected.
Here it is.
<?php
$result = ereg("(^[a-zA-Z0-9]+([a-zA-Z\_0-9\.-]*))$" , $filename);
?>
----
Server IP: 203.220.0.234
Probable Submitter: 220.236.186.153
----
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.ereg.php
Edit -- https://master.php.net/note/edit/69006
Del: integrated -- https://master.php.net/note/delete/69006/integrated
Del: useless -- https://master.php.net/note/delete/69006/useless
Del: bad code -- https://master.php.net/note/delete/69006/bad+code
Del: spam -- https://master.php.net/note/delete/69006/spam
Del: non-english -- https://master.php.net/note/delete/69006/non-english
Del: in docs -- https://master.php.net/note/delete/69006/in+docs
Del: other reasons-- https://master.php.net/note/delete/69006
Reject -- https://master.php.net/note/reject/69006
Search -- https://master.php.net/manage/user-notes.php