need some regex help javascript -


i hoping can me, using javascript , asp

i have string /folder1/folder2/pagename.asp

i need regex strip /pagename.asp string

pagetype.replace(/\/.*?\.asp/ig, ''); 

the regex above halfway there problem strippes beginning / between / , .asp

how make regex lazy strip between last / , .asp?

any appreciated!

try this:

pagetype.replace(/\/[^\/]*\.asp/ig, ''); 

i've used [^\/] group represent symbol not equal /.


Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -