Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
  2. > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
  3. ## Install
  4. ```
  5. $ npm install ansi-regex
  6. ```
  7. ## Usage
  8. ```js
  9. const ansiRegex = require('ansi-regex');
  10. ansiRegex().test('\u001B[4mcake\u001B[0m');
  11. //=> true
  12. ansiRegex().test('cake');
  13. //=> false
  14. '\u001B[4mcake\u001B[0m'.match(ansiRegex());
  15. //=> ['\u001B[4m', '\u001B[0m']
  16. ```
  17. ## FAQ
  18. ### Why do you test for codes not in the ECMA 48 standard?
  19. Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
  20. On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
  21. ## Maintainers
  22. - [Sindre Sorhus](https://github.com/sindresorhus)
  23. - [Josh Junon](https://github.com/qix-)
  24. ## License
  25. MIT