JSFiddle - React, Tailwind, and code Playground

by wirey00

JavaScript

var x = '1-800-123-1234,800-123-1234,123-1234,123.1234,123.123.1234';

console.log(x.match(/\d(-|.)|\d{1,3}(.|-)/g));