diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index d3a51d9..1b4ab9c 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -157,7 +157,7 @@ protected function opContainsWord($expression) { // Match all words separated by spaces or sentences encapsulated by double // quotes. - preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->value, $matches, PREG_SET_ORDER); + preg_match_all(static::WORDS_PATTERN, ' ' . $this->value, $matches, PREG_SET_ORDER); // Switch between the 'word' and 'allwords' operator. $type = $this->operator == 'word' ? 'OR' : 'AND'; diff --git a/core/modules/views/src/Plugin/views/filter/StringFilter.php b/core/modules/views/src/Plugin/views/filter/StringFilter.php index 10c4070..618b584 100644 --- a/core/modules/views/src/Plugin/views/filter/StringFilter.php +++ b/core/modules/views/src/Plugin/views/filter/StringFilter.php @@ -14,6 +14,11 @@ */ class StringFilter extends FilterPluginBase { + /** + * All words separated by spaces or sentences encapsulated by double quotes. + */ + const WORDS_PATTERN = '/ (-?)("[^"]+"|[^" ]+)/i'; + // exposed filter options protected $alwaysMultiple = TRUE; @@ -267,7 +272,7 @@ protected function opContainsWord($field) { return; } - preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->value, $matches, PREG_SET_ORDER); + preg_match_all(static::WORDS_PATTERN, ' ' . $this->value, $matches, PREG_SET_ORDER); foreach ($matches as $match) { $phrase = FALSE; // Strip off phrase quotes