diff --git a/src/TokenOrTokensPreAlter.php b/src/TokenOrTokensPreAlter.php
index 3c118b9ac461ec00a65be6d5ff4f04e0b654e3a7..417509103eb879d7b1b85167391277574d784772 100644
--- a/src/TokenOrTokensPreAlter.php
+++ b/src/TokenOrTokensPreAlter.php
@@ -45,7 +45,7 @@ class TokenOrTokensPreAlter {
     foreach (reset($matches) as $match) {
       if (strpos($match, '|') !== FALSE) {
         $match_clean = substr(substr($match, 1), 0, -1);
-        $sub_tokens = explode('|', $match_clean);
+        $sub_tokens = preg_split('/\|(?=(?:[^"]*"[^"]*")*[^"]*$)/', $match_clean);
 
         foreach ($sub_tokens as $sub_token) {
           if (substr($sub_token, 0, 1) === '"' && substr($sub_token, -1, 1) === '"') {