public function TwigExtension::pregReplaceFilter in Twig Tweak 8.2
Same name and namespace in other branches
- 8 src/TwigExtension.php \Drupal\twig_tweak\TwigExtension::pregReplaceFilter()
Performs a regular expression search and replace.
Parameters
string $text: The text to search and replace.
string $pattern: The pattern to search for.
string $replacement: The string to replace.
Return value
string The new text if matches are found, otherwise unchanged text.
File
- src/
TwigExtension.php, line 1049
Class
- TwigExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\twig_tweakCode
public function pregReplaceFilter($text, $pattern, $replacement) {
return preg_replace($pattern, $replacement, $text);
}