Javascript examples for String Operation:String Substring
obtain a string between two specific strings using regex
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w ww . j ava 2 s . c o m var re = /open +(.+?) +1/g, matches = [], input = "test open value 1 0 4 0 10.7kb 10.7kb test open value 1 2 3 5 5 0 3 0 8.6kb 8.6kb"; while (match = re.exec(input)) matches.push(match[1]); console.log(matches); } </script> </head> <body> </body> </html>