.
..
.svn
I ended up approaching this by using regex that will exclude these, however I'm wondering how to write regex which will NOT match them.
Here's what I tried, it doesn't work.
Code: Select all
#^(?:[^\.]|[^\.]{2}|[^(?:svn)]).*$#Moderator: General Moderators
Code: Select all
#^(?:[^\.]|[^\.]{2}|[^(?:svn)]).*$#Code: Select all
if (preg_match('/^(?!\.{1,2}$|\.svn$).+$/m', $contents)) {
# Successful match
} else {
# Match attempt failed
}No Match .
No Match ..
No Match .svn
Match .htaccess
Match includes
Match images
Code: Select all
switch ($contents)
{
case ".":
case "..":
case ".svn":
//do nothing
break;
default:
//your code here
}