I am using the goal of validating a Folder Path to explore the use of Regex in PellesC programming.
It is very popular in text editor use, but I think it's main value would be in programming.
It is not a simple subject, there is a lot of terminology, there are so many ways it is used, it has evolved. In one place it is simple. Posix seems fairly old. Spencer seemed to do his work from Toronto in about 1997.
The only way I can explore what I can do with the Regex possibilities in the PellesC compiler is to try it.
My next need may be to validate other types of user input info. Perhaps data in a format I have defined.
When I try to understand something, I loosely have a need, and I use it as an excuse to explore a tool / technique.
The fastest way to validate the file is to try to open it... If fopen() or CreateFile() fails, the file isn't there.
From the start of my first thread, (in my mind) I was talking about a Folder Path. A folder path that will be created, if it does not exist, automatically by third party software so it has to be legitimate (and it does crazy things if the folder path is illegal). When I started to see problems with the *, I backed up to a simple example to show I could not get it to work even on a single letter properly.
This IS the sort of thing that Regex is used for in all programming languages, ......verifying user input.
I am not very interested in using regular expressions on files. Grep, awk, eGrep and a bunch more. I am interested in using it the most powerfull way that I can in C & windows programming .
This limits the possibilities. I would like to find out how limited it is. Not being able to use the repeat operator, in the way I think it is used (* or .), would be a serious limit.
I am hoping someone who has used Regex in PellesC, who has explored this for the tool potential that it is, can advise me.
If I had wanted a get-around, in the beginning I would have taken the user input in, (prior to my program calling the third party software) and tried to Create the Directory, I would then have tried to set the directory as the current directory, and !upon failure known the folder path must not have been legitimate as the folder does not exist. Or perhaps GetFileAttributes , as Timo suggests, on the Directory. These other methods would have been a whole lot easier than messing with Regex, but I would not have learned anything new.
Instead, I used this as an excuse to learn how to use the Regex possibilities that PellesC gives me: I came a long way, I was hoping I could go further.... Even if I find out it cannot be done that will achieve my goal, and would start looking for options like the "LCC-Win32 C Library", but if it were not necessary it would be going off on a tangent.
If after a couple weeks, no one has a reply that confirms things or corrects me in some way.... I will start to look in that direction.
Thanks, Ed