We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e289162 commit b97e0dcCopy full SHA for b97e0dc
index.js
@@ -1,5 +1,9 @@
1
'use strict';
2
3
-module.exports = function() {
4
- return new RegExp('^\\s*(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?\\s*$');
+module.exports = function(options) {
+ options = options || {};
5
+ var regexBase = '\\s*(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?\\s*';
6
+
7
+ return options.exact ? new RegExp('^' + regexBase + '$') :
8
+ new RegExp(regexBase, 'g');
9
}
0 commit comments