Docs edit, noted double backslash requirement for some regex operators (#1361)
This commit is contained in:
1 file changed
+2
-1
@@ -205,10 +205,11 @@ title('aBc') => 'Abc'
|
|||||||
### `replace(string, regex, repl?); replace_first(string, regex, repl?)`
|
### `replace(string, regex, repl?); replace_first(string, regex, repl?)`
|
||||||
|
|
||||||
Replaces all, or first occurence of a regular expression in the string with `repl` expression,
|
Replaces all, or first occurence of a regular expression in the string with `repl` expression,
|
||||||
or nothing, if not specified
|
or nothing, if not specified. To use escape characters (`\(`,`\+`,...), metacharacters (`\d`,`\w`,...), or position anchors (`\b`,`\z`,...) in your regular expression, use two backslashes.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
replace('abbccddebfg','b+','z') // => azccddezfg
|
replace('abbccddebfg','b+','z') // => azccddezfg
|
||||||
|
replace('abbccddebfg','\\w$','z') // => abbccddebfz
|
||||||
replace_first('abbccddebfg','b+','z') // => azccddebfg
|
replace_first('abbccddebfg','b+','z') // => azccddebfg
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user