Javascript examples for RegExp:RegExp Match
Use regex to match between two sub strings
<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 va 2 s .co m*/ var str = 'iasfaisnhf Lat: 46.7132N, Long: 116.997W EFONASDF', latPattern = /Lat: (\d*\.\d+)/, longPattern = /Long: (\d*\.\d+)/; console.log(latPattern.exec(str)[1]); console.log(longPattern.exec(str)[1]); }); </script> </head> <body> </body> </html>