<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Click the button to find a difference between nx and nxy.</p>
<button onclick="myFunction()">Click me</button>
<p id="point"></p>
<script>
var x = document.getElementById("point");
function myFunction() {
var str = "a1 b12 c144 d1728 e20736";
var p1 = /\d{3}/g;
var p2 = /\d{2,3}/g;
var r1 = "q{X} = " +str.match(p1);
var r2 = "q{X,Y} = " +str.match(p2);
x.innerHTML = r1+"<br>"+r2;
}
</script> </body>
</html>