diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 1a0d9d1..7b4019d 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -1296,7 +1296,7 @@ function _filter_url($text, $filter) {
         }
         // Otherwise, check whether this is the closing tag for $open_tag.
         else {
-          if (preg_match("`<\/$open_tag>`i", $chunks[$i], $matches)) {
+          if (strcasecmp($chunks[1], "</$open_tag>") == 0) {
             $open_tag = '';
           }
         }
