[Solved] Regex to allow PhoneNumber with country code


\+\d{1,4}-(?!0)\d{1,10}\b

Breakdown:

\+                        Match a literal +
\d{1,4}                   Match between 1 and 4 digits inclusive
-                         Match a literal -
(?!                       Negative lookahead, fail if
  0                       this token (literal 0) is found
)
\d{1,10}                  Match between 1 and 10 digits inclusive
\b                        Match a word boundary

Demo (with your examples)

var phoneRegexp = /\+\d{1,4}-(?!0)\d{1,10}\b/g,
  tests = [
    '+91234-1234567',
    '+9123-1234567',
    '+',
    '-',
    '91234545555',
    '+91-012345',
    '+91-12345678910'
  ],
  results = [],
  expected = [false, true, false, false, false, false, false];

results = tests.map(function(el) {
  return phoneRegexp.test(el);
});

for (var i = 0; i < results.length; i++) {
  document.getElementById('result').textContent += (results[i] === expected[i]) + ', ';
}
<p id="result"></p>

4

solved Regex to allow PhoneNumber with country code