Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get phone number from string

const string = 'test1 +91 9443134651 test2 +1 671-765-0091';
let phone_numbers = [];
const regexp = new RegExp("+?(?d*)? ?(?d+)?d*([s./-]?d{2,})+","g");

let match;
while ((match = regexp.exec(string)) !== null) {
  console.log(`${match[0]}`);
}
// output:
//+91 9443134651
//+1 671-765-0091
//+33442207724
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to get the div value in jquery 
Javascript :: discord client.send_message js 
Javascript :: if we run 9119 through the function, 811181 will come out, because 92 is 81 and 12 is 1. 
Javascript :: how to find repeated characters in a string in javascript 
Javascript :: ajax open new tab with post 
Javascript :: findbyid mongoose 
Javascript :: if cart empty shopify 
Javascript :: how to add field to object in js 
Javascript :: javascript callback 
Javascript :: array map destructuring 
Javascript :: patch request javascript 
Javascript :: js substring first 4 numbwe 
Javascript :: object traversal javascript 
Javascript :: javascript inject html 
Javascript :: how to check if value is undefines if condition jquery 
Javascript :: javascript multidimensional array foreach 
Javascript :: modal.hide not working 
Javascript :: javascript indexof with condition 
Javascript :: kendo template multiselect default selected 
Javascript :: icon button react 
Javascript :: while vs do while javascript 
Javascript :: string uppercase 
Javascript :: javascript string remove substring 
Javascript :: html get class property 
Javascript :: js object using variable as key 
Javascript :: make form submit on new tab using jquery 
Javascript :: get user time using timezone javascript 
Javascript :: express router file 
Javascript :: how to convert a queryset into json string 
Javascript :: convert associative array to json javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =