mardi 22 janvier 2019

ignore patterns parsing

I am making a simple (MS Windows) backup program by C# using seven zip compression. Certain files and folders shall be ignored and these ignore specifications (patterns) are to added in dedicated ignore files. My program loops through all possible folders and files possibly to be backed up in a recursive way. Regex is an obvious candidate for this kind of pattern matching, but patterns to be specified must be fairly simple for the end user to design and my feeling is that regex tends to be too complicated and "ugly" for the non-nerdy end user. Anyone knows a fairly common pattern specifications which is paired with good libraries for matching (preferably .net for C# use)? The full flexibility of regex is not really necessary, but some elements of it is necessary e.g. to filter out a file/folder where the filename extension ends with an underscore, a given word and finally 1 or 2 digits (just an example to illustrate the (low) level of complexity/flexibility needed). Actually what is needed is probably something similar to gitignore, but without git (even if it is acceptable to use some git api to test for match).

Aucun commentaire:

Enregistrer un commentaire