HansDampfHH Posted November 17, 2014 Share Posted November 17, 2014 Perhaps a slight trouble, but I can not solve it: Match only path like: Trainings/1/test.pdf but dont match one more directory like this: Trainings/1/4/other.pdf Any suggestions? Link to comment https://forums.phpfreaks.com/topic/292512-rookie-needs-help-filtering-path/ Share on other sites More sharing options...
trq Posted November 17, 2014 Share Posted November 17, 2014 You don't need a regex unless you actually need to match a pattern.. <?php if (substr_count($path, '/') > 2) { echo "Directories too deep"; } Link to comment https://forums.phpfreaks.com/topic/292512-rookie-needs-help-filtering-path/#findComment-1496783 Share on other sites More sharing options...
HansDampfHH Posted November 17, 2014 Author Share Posted November 17, 2014 How simple, of course. Thanks a lot for the hint ;-) Link to comment https://forums.phpfreaks.com/topic/292512-rookie-needs-help-filtering-path/#findComment-1496786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.