regex - Regular expression pattern -


i looking create regular expression work iis url rewrite rules. looking expression match first 2 instance, not third. looking return name of folder2 whenever there isn't file name present on end of line.

folder1/folder2 folder1/folder2/ folder1/folder2/file.htm  ^folder1/([^/]*)/?$ 

i thought expression return name of second folder, optional /, when second folder and/or slash end of line. matching first example , none of slashes.

try sample of regex:

folder1[\/]{1}([^\/]+)[\/]{0,1}[\n] 

demo


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -