Reputation: 1158
I am looking to create a regular expression to work with IIS URL rewrite rules. I am looking for an expression to match the first two instance, but not the third. I am looking to return the name of Folder2 whenever there isn't also a file name present on the end of the line.
Folder1/Folder2
Folder1/Folder2/
Folder1/Folder2/File.htm
^Folder1/([^/]*)/?$
I thought this expression would return the name of the second folder, with an optional /, when the second folder and/or slash is also the end of the line. But it is only matching the first example and none of the slashes.
Upvotes: 0
Views: 24
Reputation: 1158
This is what I ended up having to use with IIS.
^Folder1/([^/^.]*)/?$
Upvotes: 0
Reputation: 169
try this sample of regex:
Folder1[\/]{1}([^\/]+)[\/]{0,1}[\n]
Upvotes: 1