Help:Parser functions/rreplace
Jump to navigation
Jump to search
| rreplace | {{#rreplace: string=
|pattern=
|replacement=
|multiline=false
|caseless=false
|ungreedy=false
|extended=false
|dotall=false
}} |
|
Regex text function for replacing a string or substring; akin to PHP preg_replace(), JS replace(), etc.
- Source
- RegexFunctions
- Parameters
string $string Source text to replace. string $pattern Regex pattern to apply string $replacement Text to replace the matched result. Output captures with \1or$1(${1}1for adjacent literal characters).bool multiline Positional anchors ^and$should mark boundaries of a single line instead of the full string.bool caseless Pattern should ignore case (case-insensitive) bool ungreedy Make quantifiers and+match ungreedily when not explicitly prohibited (trailing?)
bool extended Allow inline comments bool dotall Allow .to match newlines.
- Returns
- string Modified or unmodified string (if no changes).