Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebinsua/ietf-language-tag-regex
Regular expressions for matching IETF language tags (BCP 47)
https://github.com/sebinsua/ietf-language-tag-regex
bcp bcp-47 i18n ietf internationalization language locales localisation tag translations
Last synced: 29 days ago
JSON representation
Regular expressions for matching IETF language tags (BCP 47)
- Host: GitHub
- URL: https://github.com/sebinsua/ietf-language-tag-regex
- Owner: sebinsua
- Created: 2017-03-02T15:01:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-02T19:22:05.000Z (over 7 years ago)
- Last Synced: 2024-10-11T08:10:05.990Z (about 1 month ago)
- Topics: bcp, bcp-47, i18n, ietf, internationalization, language, locales, localisation, tag, translations
- Language: JavaScript
- Size: 60.5 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# `ietf-language-tag-regex`
> Regular expressions for matching IETF language tags (BCP 47)Based on this [Stack Overflow comment](http://stackoverflow.com/a/7036171) by George Pollard.
## Install
## Usage
```js
const languageTagRegex = require('ietf-language-tag-regex')
languageTagRegex().test('en-GB') // true
languageTagRegex().test('a-DE') // false
languageTagRegex().test('zh-Hant') // true```
## API
### languageTagRegex(options)
Returns a regex for matching IETF language tags.
#### options
##### exact
Type: `boolean`
Default: `true`Only match an exact string. Useful with `RegExp#test` to check if a string is a language tag.