Module: text
replace
Back to Index text |> (
pattern: regex
replacement: text
count: number|nothing
): text
replace replaces a matching substring count number of times from an input text. If count is not set, all matching substrings will be replaced.
Availability
| Discount | Rule | Reactor |
|---|---|---|
Examples
Replace whitespace with underscore
import { replace } from 'text'
from 'This is a sentence' replace(/\s/, '_')
// Returns:'This_is_a_sentence'