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 955B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #regexp-clone
  2. ==============
  3. Clones RegExps with flag and `lastIndex` preservation.
  4. ```js
  5. const regexpClone = require('regexp-clone');
  6. const a = /somethin/misguy;
  7. console.log(a.global); // true
  8. console.log(a.ignoreCase); // true
  9. console.log(a.multiline); // true
  10. console.log(a.dotAll); // true
  11. console.log(a.unicode); // true
  12. console.log(a.sticky); // true
  13. const b = regexpClone(a);
  14. console.log(b.global); // true
  15. console.log(b.ignoreCase); // true
  16. console.log(b.multiline); // true
  17. console.log(b.dotAll); // true
  18. console.log(b.unicode); // true
  19. console.log(b.sticky); // true
  20. const c = /hi/g;
  21. c.test('this string hi there');
  22. assert.strictEqual(c.lastIndex, 3);
  23. const d = regexpClone(c);
  24. assert.strictEqual(d.lastIndex, 3);
  25. d.test('this string hi there');
  26. assert.strictEqual(d.lastIndex, 14);
  27. assert.strictEqual(c.lastIndex, 3);
  28. ```
  29. ```
  30. npm install regexp-clone
  31. ```
  32. ## License
  33. [MIT](https://github.com/aheckmann/regexp-clone/blob/master/LICENSE)