I know this may sound a little confusing, so I am open to suggestions on renaming the title.
Basically I have string such as C:…\Downloads\Folder\SubFolder\SubSubFolder. and I want to return the SubFolder and SubSubFolder only.
So far, my Regex looks like (?=\\Downloads\\.*?\\).* which matches Downloads\Folder\SubFolder\SubSubFolder.
Does anybody have any Ideas what I am missing????
All the solutions below seem to work (except if you didn’t know “Folder”). Potentially a bug with the tool I was using to test the regular expressions.
You’re missing a single
<. You want a look-behind ((?<=...)), but you have a look-ahead ((?=...)).In other words, you need
(?<=\\Downloads\\.*?\\).*.