diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 29abf88..fa49008 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -1772,7 +1772,7 @@ public static function trimText($alter, $value) {
         else {
           $found = preg_match("/$regex/us", $value, $matches);
         }
-        if ($found) {
+        if ($found && $matches[1] != FALSE) {
           $value = $matches[1];
         }
       }
diff --git a/core/modules/views/src/Tests/Handler/FieldKernelTest.php b/core/modules/views/src/Tests/Handler/FieldKernelTest.php
index cbf65ef..f397afc 100644
--- a/core/modules/views/src/Tests/Handler/FieldKernelTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldKernelTest.php
@@ -792,6 +792,9 @@ public function testTrimText() {
       $result_text = FieldPluginBase::trimText($alter, $line);
       $this->assertEqual($result_text, $expect[$key]);
     }
+
+    $result_text = FieldPluginBase::trimText($alter, 'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch');
+    $this->assertEqual($result_text, 'Llanfairpw');
   }
 
 }
