Reputation: 8630
Say you have a path that can be one of:
What's an effective regex to capture just the directory hierarchy from paths like these, resulting in capturing just Foo/Bar ?
Foo/Bar
Upvotes: 1
Views: 179
Reputation: 80629
^(.*?)(?:/(?:[^/.]*\.[^/.]+)?)?$
Upvotes: 2