I have done some work with regular expressions using regex in Unix, but the format for regex in Windows is different. I have downloaded the gnu Win32 version of regex and would like to learn how to use it in either Visual C++ 6.0 or Dev-C++ 4.0.1. The documentation only breifly covers the functionality and does not provide any useful examples.
What I am trying to do is read a line from a file into a string and then parse the desired items based on a '|' delimeter. Here is a portion of what I am currently using to parse through the string:This is just a small portion of it. I would like to try doing the same thing using regcomp() or regexec(), but I still don't understand how I use the regex_t structure with these functions to fill one string with the data pulled out of another. Useful examples or documentation that anyone might be able to pass on would be much appreciated.Code:/* **edit** sorry - forgot to add that I typedef some things PC = char * CH = char UI = unsigned int */ if (pcLine[0] != '|') { // skip lines that don't start with a pipe return; } // skip over the initial delimiter PC pcCursor(pcLine + 1); CH chTemp[255] = ""; // start with the name field UI uiCursor = 0; while (*(pcCursor) != '|') chTemp[uiCursor++] = *(pcCursor++);
Thanks,
David