Regex module

replace

procedure · 2 overloadsSource

Replaces the first match. In replacement, $1 / ${1} is a group's text, $name / ${name} a named group's, and $$ a dollar sign; a group that did not match (or does not exist) gives "". $name takes the longest run of letters, digits and _, so write ${1}st rather than $1st.

replace :: (re: *Regex, text: string, replacement: string) -> string

Replaces the first match. In replacement, $1 / ${1} is a group's text, $name / ${name} a named group's, and $$ a dollar sign; a group that did not match (or does not exist) gives "". $name takes the longest run of letters, digits and _, so write ${1}st rather than $1st.

Parameters

re: *Regex
text: string
replacement: string

Returns

string
replace :: ($R: Type, text: string, replacement: string) -> string

Parameters

$R: Type
text: string
replacement: string

Returns

string

See also