Javascript examples for String Operation:String Search
Read characters within brackets () inside a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from w w w . j a v a 2 s . c o m function myFunction() { var s = "Hello (World) This is (Working)"; var i = 0; var outputs = []; while ((i = s.indexOf('(', i)) != -1) { var stop = s.indexOf(')', i); outputs.push(s.slice(i + 1, stop)); i++; } document.write(outputs.join(' ')); } myFunction(); }); </script> </head> <body> </body> </html>