url1: /dir-images/no1/top-left.gif
url2: /test-1/test-2/test
I want to match the path before the last slash if it is an image file(url1), aka /dir-images/no1/
and match the whole path if it is not(url2), /test-1/test-2/test
tried ^([\=\/\.\w-]+\/)+
this could get path before the last slash no matter what is after it..