@orioro/expression-regexp
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

regexpExpressions

npm install @orioro/regexp-expressions
yarn add @orioro/regexp-expressions

Previously the expressions defined in this module were available in the built-in expressions at @orioro/expression module. Due to risks related to RegExp Denial of Service (ReDoS), all expressions that took regexps as input ($stringMatch, $stringTest and $stringReplace) were isolated. As a manner of mitigation, this module provides 2 distinct builds, one targeted at Node.js (which uses RE2 https://github.com/uhop/node-re2/) and one targeted at the Browser (which uses JS built-in RegExp constructor). The Node.js build should be safe against ReDoS due to the protection offered by RE2 project.

API Docs

$stringMatch(regexp, value)
  • regexp {String | [String, String?]}
  • value {String}
  • Returns: {String[]}
$stringTest(regexp, value)
  • regexp {String | [String, String?]}
  • value {String}
  • Returns: {Boolean}
$stringReplace(searchExp, replacementExp)
  • searchExp {String | [String, String?]}
  • replacementExp {String}
  • Returns: {String}
$stringSplit(regexp, value)
  • regexp {String | [String, String?]}
  • value {String}
  • Returns: {String[]}

Readme

Keywords

none

Package Sidebar

Install

npm i @orioro/expression-regexp

Weekly Downloads

6

Version

1.1.0

License

ISC

Unpacked Size

24.6 kB

Total Files

15

Last publish

Collaborators

  • simonfan