replace

Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.

See also matches.

Syntax

replace(regex, text)
Parameter Description
regex The regular expression to be searched for.
text The string that replaces the matched substring.

Examples

$('VarName').replace(/yes/, '1')