[PHP] preg split question

2003-03-27 Thread Torsten Rosenberger
Hello i'd like to split Benutzer_CRA.php to get CRA but sometimes the files are called Benutzer_OVE_CRA.php and therefore the result schould OVE_CRA how cann i tell preg_split to split the string at the first occurence of _ and before .php BR/Torsten -- PHP General Mailing List

Re: [PHP] preg split question

2003-03-27 Thread Jonathan Pitcher
Torsten, You could use explode on the file name and then only read in the sections that you want: $FileName = Benutzer_OVE_CRA.php; $Part1 = explode(_, $FileName_); $TotalPart1 = count($Part1); $Wanted_File_Pieces = array(); // C = 2 so that it will skip the Benutzer part of the filename and

Re: [PHP] preg split question

2003-03-27 Thread CPT John W. Holmes
i'd like to split Benutzer_CRA.php to get CRA but sometimes the files are called Benutzer_OVE_CRA.php and therefore the result schould OVE_CRA how cann i tell preg_split to split the string at the first occurence of _ and before .php preg_match(/_(.*)\.php/,$str,$matches); $matches[1]