# phone-regex

> Regular expression for phone numbers.

Latest version **2.1.0** (published 2017-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install phone-regex
pnpm add phone-regex
yarn add phone-regex
bun add phone-regex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-09-23 |
| First published | 2014-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | John Otander |
| Maintainers | tunnckocore, johno |
| Keywords | phone, number, regex, phone-regex, phone-number |

## Links

- npm: https://www.npmjs.com/package/phone-regex
- Repository: https://github.com/johnotander/phone-regex
- Issues: https://github.com/johnotander/phone-regex/issues
- npm.io page: https://npm.io/package/phone-regex

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-09-23
- 2.0.0 — 2015-01-24
- 1.0.0 — 2014-12-29
- 0.0.1 — 2014-11-26

## README

# Phone Regex

[![Build Status](https://travis-ci.org/regexps/phone-regex.svg?branch=master)](https://travis-ci.org/regexps/phone-regex)

A regular expression for matching phone numbers.

## Installation

```
npm i --save phone-regex
```

## Usage

```javascript
var phone = require('phone-regex');

// Exact string option
phone({ exact: true }).test('1234567890')       // => true
phone({ exact: true }).test('apple 1234567890') // => false

// Global option (default)
phone().test('1234567890')       // => true
phone().test('apple 1234567890') // => true
phone().test('apple')            // => false

// Indian option
phone({ indian: true }).test('mango 9744142626')              // => true
phone({ indian: true }).test('mango 1234567890')              // => false
phone({ indian: true, exact: true }).test('mango 9744142626') // => false
```

## Acknowledgements

* Regex from <http://stackoverflow.com/a/16702965/1378668>.

## License

MIT

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Crafted with <3 by [John Otander](http://johnotander.com).
Support for Indian Numbers added by [Livin Mathew](https://github.com/Livin21).

---
_Source: https://npm.io/package/phone-regex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
