I'm trying to create a regex for the following pattern:-
1234,4321;5678,8765;1234,4321;5678,8765;1234,4321;5678,8765;
/[0-9]+,[0-9]+;/g or /\d+,\d+;/g doesn't seem to work in JavaScript.
Output:-
false
function myFunction() {
var str = "1234,4321;1234,4321;1234,4321;1234,4321;";
var patt = new RegExp(/[0-9]+,[0-9]+;/g);
var res = patt.test(str);
document.getElementById("demo").innerHTML = res;
}
myFunction()
<div id="demo"></div>
booleanindicating if there are matches or not. it doesn't return actual matches. UseString.match()for that;?