patil-ashutosh / go-regex-utility

A curated list of golang applications using regex
MIT License
3 stars 8 forks source link

Validate and Decompose File Paths #29

Open suramrit opened 4 years ago

suramrit commented 4 years ago

Suggested Feature - Validate and extract components of a File Path

Description: Given a string that describes a file path, we can validate that the path is correct and if valid, we extract the components of the path. The complexity of the problem lies in differentiating between different addressing: mac, windows, unix, network based

Egs: mac/Linux - /Users/topFolder/subFolder/File.ext - returns [true, [Users, topFolder,subFolder], file.ext] Windows - C:\Projects\apilibrary\apilibrary.sln - returns [true, [C, Projects,apilibrary] , apilibrary.sln] Windows Network path - \ComputerName\SharedFolder\Resource - returns [true, [ComputerName,Shared Folder], Resource] Incorrect - sample.txt/folder/ - returns [false,nil, ""]