मल्टीपल मैचेस ढूंढने के लिए, जावास्क्रिप्ट रेगुलर एक्सप्रेशन लिखें। मल्टीपल मैचेस के लिए रेगुलर एक्सप्रेशन लागू करने के लिए निम्नलिखित कोड चलाएं:
उदाहरण
<html> <head> <script> var url = 'https://www.example.com/new.html?ui=7&demo=one&demo=two&demo=three four', a = document.createElement('a'); a.href = url; var demoRegex = /(?:^|[&;])demo=([^&;]+)/g, matches, demo = []; while (matches = demoRegex.exec(a.search)) { demo.push(decodeURIComponent(matches[1])); } document.write(demo); </script> </head> <body> </body> </html>