Re: preg split question
| From: | CPT John W. Holmes | Date: | Thu, 27 Mar 2003 15:14:14 +0000 |
| Subject: | Re: preg split question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141233@lists.php.net to get a copy of this message | ||
> 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] will contain what you're looking for.
---John Holmes...