Simone: preg_match kleines Problem

Hi
Ich hab ein Problem:
Ist bestimmt nicht so schwer zu lösen  aber ich bekomm's einfach nicht hin.
Also ich möchte aus $conttestfil nur den "suchfad" isolieren
Dateiname(wort) "logfile" bleibt immer gleich

$conttestfil= "c:\programme\apache group\apache\htdocs\opti\dateimanger\hauptfad\suchfad\logfile1.rww_";

Mein Lösungsansatz:

$mask = str_replace("\", "#", $conttestfil);
  if (preg_match('/#([^"]+)#logfile/i', $mask,$suchwort))
              $suchw .=$suchwort[1];
              $suchw = str_replace("#", " ", $suchw);
              echo " $suchw";

Simone

  1. Also ich möchte aus $conttestfil nur den "suchfad" isolieren
    Dateiname(wort) "logfile" bleibt immer gleich

    dirname() ist Dein Freund: http://www.php.net/manual/de/function.dirname.php.

    Gruß,
      soenk.e

    1. Hi soenk.e
      erstmal danke!!!!

      Geht aber nicht ich bekomme als Ausgabe von
      $file1 = dirname ($conttestfil);
      "c:\programme\apache group\apache\htdocs\opti\dateimanger\hauptfad\suchfad"

      brauch aber nur "suchfad" ohne die restliche Verzeichnissausgabe

      Simone

      1. Ich hab's:

        $conttestfil= "c:\programme\apache group\apache\htdocs\opti\dateimanger\hauptfad\suchfad\logfile1.rww_";

        $mask = str_replace("\", "#", $conttestfil);
          if (preg_match('/#([^#]+)#logfile/i', $mask,$suchwort))
                      $suchw .=$suchwort[1];
                      $suchw = str_replace("#", " ", $suchw);
                      echo "............. $suchw ................";

        Simone