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++ - Convert big endian to little endian when reading from a binary file -

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

unicode - Are email addresses allowed to contain non-alphanumeric characters? -