Boost logo

Boost Users :

From: Jean-Sebastien Vachon (js.vachon_at_[hidden])
Date: 2006-04-12 21:15:33


On Wed, 12 Apr 2006 16:30:26 -0600, Lynn Allan wrote:

> Homework?
> What have you tried .... with what results?
>
> Jean-Sebastien Vachon wrote:
>> Hi there,
>>
>> I am sure what I am looking for exist somewhere but I haven't
>> been able to find anything that works in boost::regex.
>>
>> What I am looking for is a regular expression that will validate
>> a filename according to the specification of the OS (UNIX systems
>> and Windows).
>>
>> I would be very grateful if someone could provide me with
>> these two expressions (one for Linux and one for Windows).
>>
>> Later,

Hi,

So far the best expression I have for Windows is:

(((((^([a-z]:\\?)|(^\\\\[^\\;:\'\"<>]+\\[^\\]+\\)))))(((([^\\;:\'\"\<\>]+)\\)*)*)((([^\\;:\'\"<>]*))(\.?([^\\:;\'\"<>]+)))?)

I used Visual RegExp 3.0 to test and debug my expression(s).
It is a very nice tool. The

For UNIX I am currently using:
((/([^/]+)?)*)(([^/.]*).?([^/])*)

I haven't tested it completely but it seems to do the job.

If you spot any potential problem please let me know.

Later,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net