I'm looking to write a regex for a file path that must start with some prefix. In this case it should start with '/tank/home/'. I also want to make sure that it contains no '/..' -- no jumping up to parent directories.
I spent a while fiddling around without coming up with anything quite right. I settled on using two regexes, the first which must match and the second which must not match:
'^/tank/home/'
'/\.\.(/.*)?$'
Does this do what I think it does? Is there an easier way?
This is in a bash script, for what it's worth.