diff --git a/modules/filter.module b/modules/filter.module
index c77c51351e9694db58c084929da2841fb27dadbc..05d875419354845bb282f8930e4623bd95531c26 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -956,7 +956,7 @@ function _filter_autop($text) {
     if ($i % 2) {
       // Opening or closing tag?
       $open = ($chunk{1} != '/');
-      list(, $tag) = split('[< ]', $chunk);
+      list($tag) = split('[ >]', substr($chunk, 2 - $open), 2);
       if (!$ignore) {
         if ($open) {
           $ignore = true;
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index c77c51351e9694db58c084929da2841fb27dadbc..05d875419354845bb282f8930e4623bd95531c26 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -956,7 +956,7 @@ function _filter_autop($text) {
     if ($i % 2) {
       // Opening or closing tag?
       $open = ($chunk{1} != '/');
-      list(, $tag) = split('[< ]', $chunk);
+      list($tag) = split('[ >]', substr($chunk, 2 - $open), 2);
       if (!$ignore) {
         if ($open) {
           $ignore = true;