Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/valtech-commerce/capturing-group-values
Extracts capturing group values via a regular expression
https://github.com/valtech-commerce/capturing-group-values
capturing npm-package regex regexp
Last synced: about 1 month ago
JSON representation
Extracts capturing group values via a regular expression
- Host: GitHub
- URL: https://github.com/valtech-commerce/capturing-group-values
- Owner: valtech-commerce
- License: mit
- Created: 2023-02-06T21:17:36.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-06T21:42:40.000Z (almost 2 years ago)
- Last Synced: 2024-11-19T13:07:44.434Z (about 1 month ago)
- Topics: capturing, npm-package, regex, regexp
- Language: JavaScript
- Homepage:
- Size: 111 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# @valtech-commerce/capturing-group-values
[![npm](https://img.shields.io/npm/v/@valtech-commerce/capturing-group-values.svg)](https://www.npmjs.com/package/@valtech-commerce/capturing-group-values)
[![npm dependencies](https://david-dm.org/valtech-commerce/capturing-group-values/status.svg)](https://david-dm.org/valtech-commerce/capturing-group-values)
[![npms](https://badges.npms.io/%40valtech-commerce%2Fcapturing-group-values.svg)](https://npms.io/search?q=%40valtech-commerce%2Fcapturing-group-values)
[![Travis CI](https://travis-ci.com/valtech-commerce/capturing-group-values.svg?branch=master)](https://travis-ci.com/valtech-commerce/capturing-group-values/builds)> Extracts capturing group values via a regular expression
## Install
```bash
$ npm install @valtech-commerce/capturing-group-values
```## Usage
```js
import capturingGroupValues from '@valtech-commerce/capturing-group-values';const pattern = /(?[a-z]+)?:(?\d+)?/u;
console.log(capturingGroupValues('', pattern)); // {}
console.log(capturingGroupValues(':', pattern)); // {}
console.log(capturingGroupValues('abc', pattern)); // {}
console.log(capturingGroupValues('123', pattern)); // {}
console.log(capturingGroupValues('abc:xyz', pattern)); // { alpha: 'abc' }
console.log(capturingGroupValues('123:789', pattern)); // { num: '789' }
console.log(capturingGroupValues('abc:789', pattern)); // { alpha: 'abc', num: '789' }
```## Documentation
View [documentation](https://valtech-commerce.github.io/capturing-group-values)
## License
MIT © [Valtech Canada inc.](https://www.valtech.ca/)