No. By optional I meant that the person may choose not to have a certain part of the line described.
The complete line is:
Code:
[ [label] : ] [ instruction [argument] ] [ ; [comment] ]
Example:
Code:
MyLabel: burn reg10 ; This will hurt
But one may not want to have the label and the comment, and a valid line the regex should match is:
Further, a line may have just the comment:
Code:
; This is a long and painful comment and I do not write more!
See the "optional" I meant? And in all these cases I want the regex to separate the label, instruction, its argument (the "reg10" in above), and the comment. In detail: the regexec would return for me:
1st: "MyLabel", "burn", "reg10" and "; This will hurt", in order
2nd: "", "burn", "reg10" and ""
(or other indication that it failed to match the label and comment parts)
3rd: "", "", "" and "; This is a long and painful comment and I do not write more!"
And by now I canīt make any get optional in that expression. For the label part:
Code:
"([[:alpha:]_][[:alnum:]_]*):"
Simply putting ? after it will make just the caracter ":" optional. So I need to atomize it. I think the way shold be this:
Code:
"(([[:alpha:]_][[:alnum:]_]*):)"
But it wonīt work.

I think the problem is on the nested parenthesis, but I havenīt found nothing about this yet.
I hope it is more clear now. Next week I'll put code attatched here (I donīt have it now), but it is really simple: just calling regcomp and then regexes with the described stuff.
Any ideia (or even a "It works for me!", hopefully with concrete example) is very welcome.
Thanks.
Dedec0