Functions:regex replace

From Dwoo Docs

Jump to: navigation, search

Replaces the search string by the replace string using regular expressions

regex_replace(string $value, string $search, string $replace)
  • value : the string to search into
  • search : the string to search for, must be a complete regular expression including delimiters
  • replace : the string to use as a replacement, must be a complete regular expression including delimiters

Note that if you want to use backreferences, use \$1 instead of $1, \$2 for $2 and so on, otherwise Dwoo will replace the $1 as if it was a variable.




Example:

{regex_replace "abcdABCD" "/([a-z])/" "\$1*"}

Output:

a*b*c*d*ABCD
Personal tools
templates
page language

French

The article you want to access doesn't exist in French.
Deutsch
The article you want to access doesn't exist in Deutsch.
Russian
The article you want to access doesn't exist in Russian.