I have the following working regex to extract a lot of phone numbers in different formats.
See here: http://jsfiddle.net/SB5Ly/4/
var regex = new Reg
I don't know how prescriptive you want to be, but this matches all your examples:
var regex = new RegExp("\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+", "g");
See a live demo of this regex.
One small bug with your regex: When wanting to include a literal dash in a character class, either escape it or place it first or last.
You had [\\s-.]
, which is incorrect. It should be either [\\s.-]
, [-\\s.]
or [\\s\\-.]
.