Regex match take a very long time to execute

前端 未结 4 1043
轻奢々
轻奢々 2020-12-18 06:08

I wrote a regular expression that parses a file path into different group (DRIVE, DIR, FILE, EXTENSION).

^((?[a-zA-Z]):\\\\)*((?[a-zA         


        
4条回答
  •  情深已故
    2020-12-18 06:42

    I'd just use the FileInfo and Path classes to obtain the info.

    Should you choose to use a regex, then note that the regex doesn't match all legal filenames: There's a whole bunch of legal filename tokens missing from your regex.

提交回复
热议问题