Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
-
shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
-
Contact:
Post
by shiznatix »
Hey hey! Ok so I just want to know if this will work. I want to only let A-Z a-z 0-9 . - and _ though. so I think its something like this...
Code: Select all
$filename = preg_replace('#[^A-Za-z0-9\.\-_]#', $filename);
am I missing anything?
-
feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Post
by feyd »
missing third argument.
-
shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
-
Contact:
Post
by shiznatix »
feyd wrote:missing third argument.
Code: Select all
$replace = '';
$filename = preg_replace('#[^A-Za-z0-9\.\-_]#m', $replace, $filename);
like so? I added the multi-line reader thing but its a filename so can filenames actually contain a line break?