0f44f30fe06d376888adf0a52624ffccf5ed3424cb13e03d1dbfe31b3ebd3ad49a5ed1e5ac80ac5e1ad157dcc1d9e2080b43bb200ce7f4b068e9ff1611705d 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # expand-brackets [![NPM version](https://img.shields.io/npm/v/expand-brackets.svg?style=flat)](https://www.npmjs.com/package/expand-brackets) [![NPM downloads](https://img.shields.io/npm/dm/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![Build Status](https://img.shields.io/travis/jonschlinkert/expand-brackets.svg?style=flat)](https://travis-ci.org/jonschlinkert/expand-brackets)
  2. > Expand POSIX bracket expressions (character classes) in glob patterns.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install expand-brackets --save
  7. ```
  8. ## Usage
  9. ```js
  10. var brackets = require('expand-brackets');
  11. brackets('[![:lower:]]');
  12. //=> '[^a-z]'
  13. ```
  14. ## .isMatch
  15. Return true if the given string matches the bracket expression:
  16. ```js
  17. brackets.isMatch('A', '[![:lower:]]');
  18. //=> true
  19. brackets.isMatch('a', '[![:lower:]]');
  20. //=> false
  21. ```
  22. ## .makeRe
  23. Make a regular expression from a bracket expression:
  24. ```js
  25. brackets.makeRe('[![:lower:]]');
  26. //=> /[^a-z]/
  27. ```
  28. The following named POSIX bracket expressions are supported:
  29. * `[:alnum:]`: Alphanumeric characters (`a-zA-Z0-9]`)
  30. * `[:alpha:]`: Alphabetic characters (`a-zA-Z]`)
  31. * `[:blank:]`: Space and tab (`[ t]`)
  32. * `[:digit:]`: Digits (`[0-9]`)
  33. * `[:lower:]`: Lowercase letters (`[a-z]`)
  34. * `[:punct:]`: Punctuation and symbols. (`[!"#$%&'()*+, -./:;<=>?@ [\]^_``{|}~]`)
  35. * `[:upper:]`: Uppercase letters (`[A-Z]`)
  36. * `[:word:]`: Word characters (letters, numbers and underscores) (`[A-Za-z0-9_]`)
  37. * `[:xdigit:]`: Hexadecimal digits (`[A-Fa-f0-9]`)
  38. Collating sequences are not supported.
  39. ## Related projects
  40. You might also be interested in these projects:
  41. * [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://www.npmjs.com/package/extglob) | [homepage](https://github.com/jonschlinkert/extglob)
  42. * [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob)
  43. * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
  44. * [is-posix-bracket](https://www.npmjs.com/package/is-posix-bracket): Returns true if the given string is a POSIX bracket expression (POSIX character class). | [homepage](https://github.com/jonschlinkert/is-posix-bracket)
  45. * [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)
  46. ## Contributing
  47. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/expand-brackets/issues/new).
  48. ## Building docs
  49. Generate readme and API documentation with [verb](https://github.com/verbose/verb):
  50. ```sh
  51. $ npm install verb && npm run docs
  52. ```
  53. Or, if [verb](https://github.com/verbose/verb) is installed globally:
  54. ```sh
  55. $ verb
  56. ```
  57. ## Running tests
  58. Install dev dependencies:
  59. ```sh
  60. $ npm install -d && npm test
  61. ```
  62. ## Author
  63. **Jon Schlinkert**
  64. * [github/jonschlinkert](https://github.com/jonschlinkert)
  65. * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  66. ## License
  67. verb © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
  68. Released under the [MIT license](https://github.com/jonschlinkert/expand-brackets/blob/master/LICENSE).
  69. ***
  70. _This file was generated by [verb](https://github.com/verbose/verb), v, on April 01, 2016._