At 18:40 11.12.2002, Luca spoke out and said:
--------------------[snip]--------------------
>How to read "pre-extension" of file with regular expression?
>Example: name.preextension.doc
>
>I need to read "preextension"
--------------------[snip]-------------------- 

Assuming that "preextension" is _always_ preceded by at least one dot, and
_always_ followed by exactly one dot, this RE should work (untested):
          /\.([^.]*)\.[^\.]*$/

read from right to left for better understanding:
   line end
   anything before without a dot ('ext')
   a dot before
   anything without a dot before (grouped, 'preext')
   starting with a dot

The group will contain the preextension.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to