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? Quote Link to comment https://forums.phpfreaks.com/topic/292512-rookie-needs-help-filtering-path/ Share on other sites More sharing options...
Solution trq Posted November 17, 2014 Solution 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"; } Quote 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 ;-) Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.