I want to write a regular expression for a file path that should start with some prefix. In this case, it should start with '/ tank / home /'. I also want to make sure that it does not contain "/ .." - it does not jump to the parent directories.
I spent some time messing around without coming up with anything completely right. I decided to use two regular expressions, the first of which should match, and the second should not match:
'^/tank/home/'
'/\.\.(/.*)?$'
Does this do what I think he does? Is there an easier way?
This is the value of a bash script, for what it's worth
source
share