Để tìm nhiều kết quả phù hợp, hãy viết một biểu thức JavaScript. Bạn có thể thử chạy mã sau để triển khai biểu thức chính quy cho nhiều đối sánh -
Ví dụ
<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>