/**
  * Process the user-supplied options.
  */
 public function getOptions()
 {
     parent::getOptions();
     $this->search = Filter::get('search');
     $this->replace = Filter::get('replace');
     $this->method = Filter::get('method', 'exact|words|wildcards|regex', 'exact');
     $this->case = Filter::get('case', 'i');
     $this->error = '';
     switch ($this->method) {
         case 'exact':
             $this->regex = preg_quote($this->search, '/');
             break;
         case 'words':
             $this->regex = '\\b' . preg_quote($this->search, '/') . '\\b';
             break;
         case 'wildcards':
             $this->regex = '\\b' . str_replace(array('\\*', '\\?'), array('.*', '.'), preg_quote($this->search, '/')) . '\\b';
             break;
         case 'regex':
             $this->regex = $this->search;
             // Check for invalid regular expressions.
             // A valid regex on a null string returns zero.
             // An invalid regex on a null string returns false and throws a warning.
             try {
                 preg_match('/' . $this->search . '/', null);
             } catch (\ErrorException $ex) {
                 $this->error = '<div class="alert alert-danger">' . I18N::translate('The regex appears to contain an error.  It can’t be used.') . '</div>';
             }
             break;
     }
 }
 /**
  * Process the user-supplied options.
  */
 public function getOptions()
 {
     parent::getOptions();
     $this->surname = Filter::get('surname', 'add|replace', 'replace');
 }