Javascript examples for String Operation:String Search
finding part of a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w ww . j av a2 s .c o m*/ var string = '/folder1/folder2/folder3/', last = string.replace(/\//g,' ').trim().split(/\s/).pop(); document.getElementById('output').appendChild(document.createTextNode(last)); } </script> </head> <body> <div id="input"> /folder1/folder2/folder3/ </div> <div id="output"></div> </body> </html>