Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
le0pard committed Jul 14, 2023
1 parent f430caa commit 14c6d69
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ RE2JS allows you to replace all occurrences or the first occurrence of a pattern
The `replaceAll()` method replaces all occurrences of a pattern match in a string with the given replacement

```js
import { RE2JS } from 're2js'

RE2JS.compile('Frog')
.matcher("What the Frog's Eye Tells the Frog's Brain")
.replaceAll('Lizard') // "What the Lizard's Eye Tells the Lizard's Brain"
Expand All @@ -228,6 +230,8 @@ Note that the replacement string can include references to capturing groups from
The `replaceFirst()` method replaces the first occurrence of a pattern match in a string with the given replacement

```js
import { RE2JS } from 're2js'

RE2JS.compile('Frog')
.matcher("What the Frog's Eye Tells the Frog's Brain")
.replaceFirst('Lizard') // "What the Lizard's Eye Tells the Frog's Brain"
Expand Down

0 comments on commit 14c6d69

Please sign in to comment.