Originally Posted by DaWei
It isn't clear, from a posted reproduction, where the line endings are. I'm guessing that is all one line (terminated by newline, carriage return, or both), and that is also a single line. I base this on the presence of a single '#' in the first case. Commented content is probably defined as any line that begins with '#' (or has '#' as its first non-whitespace character).
Knowing that is key information.
yes .. i apologize for the confusion.. yes, all of that information is all on the same line and ends with a newline.
Obviously, the first thing is to strip the data of all comments. That's a trivial thing to do.
It appears that items of interest are all delimited by labels. strtok works with a collection of delimiters, but the delimiters are not multiple-character entities, like the labels. Regex to pick up a label would be simple to write (begins with whitespace, ends with ':'). It wouldn't be too hard to achieve that without regex.
If I was to use regex, doesn't that take in an input? but how would i be able to do that if i'm reading from a file?
You mention "performance reasons." One can't tell from the context how important that is or what is actually considered to separate poor performance from good performance.
I am not entirely certain why it is considered bad performance either.. however, I was told that it is best to use the C library function instead of calling a script to do the same job. If I find out the reasons, I will let you know.
Perhaps you could clarify some of that and I could give you some example code. Incidentally, you can prevent the smilies from appearing in atypical, cluttered text (or code) by using the advanced posting option and disabling smilies.
EDIT: You might take a cut of the file and attach it so that copy/paste wouldn't be involved, and garfle up the file with non-existent line endings, and such. That would provide some relevant information.
Thanks for the tip. I'll keep that in mind in the future.