{"id":16365986,"url":"https://github.com/captn3m0/india-pincode-regex","last_synced_at":"2025-03-23T02:32:28.058Z","repository":{"id":56888093,"uuid":"242776966","full_name":"captn3m0/india-pincode-regex","owner":"captn3m0","description":"A simple regex based exhaustive validator for PIN codes in India","archived":false,"fork":false,"pushed_at":"2023-07-10T16:23:39.000Z","size":138,"stargazers_count":5,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T03:11:28.860Z","etag":null,"topics":["india","npm-package","php","php-library","pin","pincode","regex","regexes","validator","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://github.com/captn3m0/india-pincode-regex","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/captn3m0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"captn3m0","liberapay":"captn3m0","github":"captn3m0"}},"created_at":"2020-02-24T15:51:30.000Z","updated_at":"2024-05-16T11:58:22.000Z","dependencies_parsed_at":"2024-10-28T08:04:49.102Z","dependency_job_id":"79821684-396b-458e-bce6-19af890eac4d","html_url":"https://github.com/captn3m0/india-pincode-regex","commit_stats":{"total_commits":50,"total_committers":2,"mean_commits":25.0,"dds":"0.30000000000000004","last_synced_commit":"cbc329f738d417ffa73fd1790f121272fbe79509"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captn3m0%2Findia-pincode-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captn3m0%2Findia-pincode-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captn3m0%2Findia-pincode-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captn3m0%2Findia-pincode-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/captn3m0","download_url":"https://codeload.github.com/captn3m0/india-pincode-regex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245047978,"owners_count":20552430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["india","npm-package","php","php-library","pin","pincode","regex","regexes","validator","zero-dependencies"],"created_at":"2024-10-11T02:44:57.632Z","updated_at":"2025-03-23T02:32:27.747Z","avatar_url":"https://github.com/captn3m0.png","language":"JavaScript","funding_links":["https://ko-fi.com/captn3m0","https://liberapay.com/captn3m0","https://github.com/sponsors/captn3m0"],"categories":[],"sub_categories":[],"readme":"# india-pincode-regex ![Packagist Version](https://img.shields.io/packagist/v/captn3m0/pincode?style=plastic) [![Build Status](https://travis-ci.org/captn3m0/india-pincode-regex.svg?branch=master)](https://travis-ci.org/captn3m0/india-pincode-regex) ![npm](https://img.shields.io/npm/v/pincode-validator?style=plastic) ![GitHub package.json version](https://img.shields.io/github/package-json/v/captn3m0/india-pincode-regex?style=plastic) ![GitHub](https://img.shields.io/github/license/captn3m0/india-pincode-regex?style=plastic)\n\nValidate a [Postal Index Number][wiki] for India with a few regexes and zero false-positives. The regexes are available in `regex.txt`. There is one regex per area code (the first digit of the PIN, which goes from 1-8). Available as a package for Ruby, Python, Node.js, and browsers.\n\n## Why?\n\nA simple `\\d{6}` approach marks a lot of invalid pincodes as valid. Out of the 900000 possible combinations, only approximately `19000` are valid pincodes in India. A simple example is `111111` which is an invalid pincode, but any simple 6 digit-check will pass it as a valid one.\n\n## Source\n\nThe source for the data is the [\"All India Pincode Directory\"](https://data.gov.in/resources/all-india-pincode-directory) dataset on data.gov.in. The last updated date for the dataset is currently 30th May 2019.\n\n## Usage\n\nThe `regex.txt` file is 32KB in size, so you can easily use it wherever you want, including browsers. If you are using any of the packages below, this is already delivered compressed. You can use the regex directly, or via a few helper methods.\n\n## Supported Language Versions\n\nThis project only supports [supported versions](https://endoflife.date) of various languages.\n\n### PHP\n\nThe package is available on [`packagist`](https://packagist.org/packages/captn3m0/pincode).\n\nTo use the PHP package:\n\n```php\nuse PIN\\Validator as P;\n// validates a given pincode\n// returns boolean\nP::validate('110011'); // returns true;\n\n// Searches for all valid pincodes in a given string.\n// returns array(string)\nP::search('bangalore 560029'); // returns [\"560029\"]\n```\n\n### Node.js\n\nThe package is available on [`npm`](https://www.npmjs.com/package/pincode-validator).\n\nTo use the package:\n\n```js\nconst P = require('pincode-validator');\nP.validate('110011'); // returns true\nP.search('my pincode is 560029'); // returns ['560029']\n\n// or directly use the regex in your code\nP.exactRegex.match('560029')\n\"address with pincode (560029)\".matchAll(P.regex)\n````\n\nPlease see `tests/validate.js` for more examples.\n\n## Ruby\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'pincode_validator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install pincode_validator\n\n```ruby\nrequire 'pincode_validator'\n\nPin::valid?('560029') # returns true\nPin::valid?('111111') # returns false\n\nPin::search('my pincode is 244713') # returns ['244713']\nPin::search('my pincode is 244713 or 560029') # returns ['244713', '560029']\n```\n\n### Browser\n\nTo use it in the browser, download the `pincode-regex.js` file and include it in your browser. `Pincode` is available as a Global variable.\n\n```html\n\u003cscript src=\"../pincode-regex.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nPincode.validate(\"560029\"); // returns true\n\u003c/script\u003e\n```\n\nYou can use githack for directly using this in your code: \u003chttps://rawcdn.githack.com/captn3m0/india-pincode-regex/v2.0.0/pincode-regex.js\u003e (Make sure you use the latest version). Please watch the repo to get notified of new releases.\n\n## Code of Conduct\n\nEveryone interacting in the this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/captn3m0/outliner/blob/master/CODE_OF_CONDUCT.md).\n\n## Contributing\n\n- See [`CONTRIBUTING.md`](CONTRIBUTING.md) for some development details and contribution guidelines\n- Pull requests are welcome for adding libraries in other languages (in the same repo). Python support is WIP, and I'd love to have support for other languages as well.\n- This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nLicensed under the [MIT License](https://nemo.mit-license.org/). See LICENSE file for details.\n\n[wiki]: https://en.wikipedia.org/wiki/Postal_Index_Number\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptn3m0%2Findia-pincode-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptn3m0%2Findia-pincode-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptn3m0%2Findia-pincode-regex/lists"}