@finch/regexp-replace

1.0.8 • Public • Published

📚 All guides and package documentation.


@finch/regexp-replace

🐦 Stability: 2 - Stable (added in 1.0.0)

Transformation operator that yields the value it was provided after replacing a regular expression pattern with a replacement.

Regular expressions are capable of replacing strings in an enormous variety of conditions. Tools like regexr.com are an excellent resource for regular expression learing an testing.

Read more about regular expression handling in the Getting Started guide.

Installation

npm install -g @finch/regexp-replace

🐦 Omit -g flag to install within the current directory.

Params

  • pattern: a regular expression used to match within the value.
  • replacement: a string that is replaced for the matched pattern(s).

Examples

Replace the first occurence of the word Hello with Goodbye:

{
  "use": "@finch/regexp-replace",
  "params": { "pattern": "/\\bHello\\b/", "replacement": "Goodbye" }
}

Replace every occurence of the word Hello with Goodbye:

{
  "use": "@finch/regexp-replace",
  "params": { "pattern": "/\\bHello\\b/g", "replacement": "Goodbye" }
}

🐦

Readme

Keywords

none

Package Sidebar

Install

npm i @finch/regexp-replace

Weekly Downloads

3

Version

1.0.8

License

MPL-2.0

Unpacked Size

20.2 kB

Total Files

5

Last publish

Collaborators

  • mattseeley