javascript 提取全部的的方法。javascript中没有matchAll这种方法。
用while来实现类似 PHP 中的preg_match_all() :(by default7#zbphp.com)
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <select name="AgentIdP" id="AgentIdP" onchange="selectNull('AgentIdI333');selectNull('GameId333');"></select> <script type="text/javascript"> var html = document.getElementById('AgentIdP').getAttribute('onchange'); var exp = /selectNull(['"]{1}([w-]+)['"]{1})/ig; var result ; while( (result = exp.exec(html))!= null){ console.log(result); } console.log(html); </script> </body> </html>