Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getNumbersWithFloat(value){
- const arrayOfIndex = value.split(' ');
- const lenValue = arrayOfIndex.length;
- const regExp = /^([0-9]+(.|,)+[0-9])|[0-9]$/;
- let arrayResult = [];
- for(var j=0; j<lenValue; j++){
- const match = regExp.exec(arrayOfIndex[j]);
- if(match != null){
- arrayResult.push(arrayOfIndex[j]);
- console.log(arrayResult);
- }
- }
- }
- getNumbersWithFloat('string and num 123 and 56K7 3,4 76 9,7, 9.0float');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement