Write regex to match 10 digits only from a string but exclude spaces
How can I write regex to match 10 digits from a string but exclude any number of spaces in between.
goli202084 Answered question
Here it is:-
/^(\s*\d\s*){10}$/g example below: init(); //(^[0-9]+(\s*[0-9]+)*$){0,10} function init() { var str = '0 12 34567 8 9'; console.log(str.match(/^(\s*\d\s*){10}$/g)); }
goli202084 Answered question