--- media_attach.module.old	2008-01-15 14:19:33.000000000 +0100
+++ media_attach.module	2008-01-15 14:18:47.000000000 +0100
@@ -450,7 +450,7 @@ function _media_attach_folder($nid = fal
 }
 
 function _media_attach_filter($nid, $media, $text, $teaser) {
-  if (preg_match_all(MEDIA_ATTACH_TAG, $text, $matches, PREG_SET_ORDER)) {
+  if (preg_match_all('/\[attach(.*?)\]/', $text, $matches, PREG_SET_ORDER)) {
     $strings = array();
     $replace = array();
     
@@ -458,10 +458,15 @@ function _media_attach_filter($nid, $med
     foreach ($matches as $match) {
       // get the settings for this
       $settings = array();
-      if (preg_match_all(MEDIA_ATTACH_TAG_SETTINGS, $match['settings'], $set, PREG_SET_ORDER)) {
-        foreach ($set as $s) {
-          // strip quotation marks.
-          $settings[$s['key']] = substr($s['value'], 1, strlen($s['value'])-2);
+      $settings_str=substr($match[1], 1, strlen($match[1])-1);
+      // split the settings
+      $prel_ar=split(';',$settings_str);
+      // handle each key=>value pair
+      foreach ($prel_ar as $pair){
+        $pair=split('=',$pair);
+        if (count($pair)==2){
+          // strip quotaion marks
+          $settings[$pair[0]]=substr($pair[1], 1, strlen($pair[1])-2);
         }
       }
 
