PHP preg_match, need some help
Posted
by SoLoGHoST
on Stack Overflow
See other posts from Stack Overflow
or by SoLoGHoST
Published on 2010-05-03T06:09:39Z
Indexed on
2010/05/03
6:18 UTC
Read the original article
Hit count: 159
Can someone please help me with this preg_match
if (preg_match('~[^A-Za-z0-9_\./\]~', $filepath))
// Show Error message.
I need to match a possible filepath. So I need to check for double slashes, etc. Valid file path strings should look like this only:
mydir/aFile.php
or
mydir/another_dir/anyfile.js
So a slash at the beginning of this string should be checked also. Please help.
Thanks :)
© Stack Overflow or respective owner