<html> <head> <title></title> <script type="text/javascript"> window.onload=function(){ var urlStr='https://www.baidu.com/s?pIndex='+45; var rec=/=(.+)/.exec(urlStr)[1]; alert(rec); } </script> </head> <body> </body> </html>
运行后弹出的是45。
有关更多正则学习,请详见:http://www.cnblogs.com/jamesping/articles/2252675.html#undefined
原文链接:https://www.f2er.com/regex/358804.html