You are here

protected function FindReplace::getRegexPattern in Tamper 8

Get the regex pattern.

Return value

string Regex pattern to use.

1 call to FindReplace::getRegexPattern()
FindReplace::tamper in src/Plugin/Tamper/FindReplace.php
Tamper data.

File

src/Plugin/Tamper/FindReplace.php, line 146

Class

FindReplace
Plugin implementation of the find_replace plugin.

Namespace

Drupal\tamper\Plugin\Tamper

Code

protected function getRegexPattern() {
  $regex = $this
    ->getSetting(self::SETTING_WHOLE) ? '/^' . preg_quote($this
    ->getSetting(self::SETTING_FIND), '/') . '$/u' : '/\\b' . preg_quote($this
    ->getSetting(self::SETTING_FIND), '/') . '\\b/u';
  if (!$this
    ->getSetting(self::SETTING_CASE_SENSITIVE)) {
    $regex .= 'i';
  }
  return $regex;
}